dankamongmen / growlight

notcurses block device manager / system installation tool
https://nick-black.com/dankwiki/index.php/Growlight
GNU General Public License v3.0
84 stars 12 forks source link

GPT tests fail on s390x #131

Open dankamongmen opened 3 years ago

dankamongmen commented 3 years ago
Andy Postnikov commented on a discussion:
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/15043#note_128242

locally (in s390 docker) I can reproduce it
/mnt/testing/growlight $ LANG=C src/growlight-1.2.22/build/growlight-tester
Running with LANG=C
Running with TERM=xterm
[doctest] doctest version is "2.4.1"
[doctest] run with "--help" for options
===============================================================================
/mnt/testing/growlight/src/growlight-1.2.22/tests/gpt.cpp:6:
TEST CASE:  GPT
  CRC32

/mnt/testing/growlight/src/growlight-1.2.22/tests/gpt.cpp:56: ERROR: CHECK(
2006165414 == head.crc ) is NOT correct!
  values: CHECK( 2006165414 == 4119344763 )

===============================================================================
[doctest] test cases:   1 |   0 passed | 1 failed | 0 skipped
[doctest] assertions: 440 | 439 passed | 1 failed |
[doctest] Status: FAILURE!

this comes from https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/15043#note_128242, alpine's 1.2.22

dankamongmen commented 3 years ago

note that it seems we're only miscalculating the main crc, not the partition crc two lines later. hrmmm.

dankamongmen commented 3 years ago

s390x:

SIZE: 92 CRC: f588367b RES: 00000000
GUID: ^����0F�=Tn��
AME: EFI PART
(00) 45464920 50415254
(08) 00010000 0000005c
(16) f588367b 00000000
(24) 00000000 00000001
(32) 00000000 003fffef
(40) 00000000 00000022
(48) 00000000 003fffce
(56) 5e8690ef d0300346
(64) 993d546e b0e71b0d
(72) 00000000 00000002
(80) 00000080 00000080
(88) ab54d286 ffffffff

x86_64:

SIZE: 92 CRC: 7793a7a6 RES: 00000000
LBA: 0000000000000001 BLBA: 00000000003fffef
GUID: ^����0F�=Tn��

AME: EFI PART
(00) 20494645 54524150
(08) 00010000 0000005c
(16) 7793a7a6 00000000
(24) 00000001 00000000
(32) 003fffef 00000000
(40) 00000022 00000000
(48) 003fffce 00000000
(56) ef90865e 460330d0
(64) 6e543d99 0d1be7b0
(72) 00000002 00000000
(80) 00000080 00000080
(88) ab54d286 00007f00
dankamongmen commented 3 years ago

OK, crc32() is most certainly endian-sensitive at the word level, no matter what dumbasses say on the internet. argh.