dankamongmen / growlight

notcurses block device manager / system installation tool

Home Page:https://nick-black.com/dankwiki/index.php/Growlight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

creating corrupt GPT partition tables

dankamongmen opened this issue · comments

See #79. We appear to be generating corrupt GPT master and backup partition tables. I'm not sure how long this has been going on (perhaps only since the zlib changes in #91), but gparted plainly recognizes our sad, corrupt attempts at GPT.

Yeah it does indeed look like bad CRCs:

[grimes](0) $ diff -ur g.hex g2.hex 
--- g.hex	2020-11-27 03:22:59.821645078 -0500
+++ g2.hex	2020-11-27 03:23:04.771583979 -0500
@@ -31,10 +31,10 @@
 000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 000001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.
 00000200: 4546 4920 5041 5254 0000 0100 5c00 0000  EFI PART....\...
-00000210: 7265 0136 0000 0000 0100 0000 0000 0000  re.6............
+00000210: 90d1 a7f1 0000 0000 0100 0000 0000 0000  ................
 00000220: ffff d31c 0000 0000 2200 0000 0000 0000  ........".......
-00000230: deff d31c 0000 0000 0075 d6a0 f872 0445  .........u...r.E
-00000240: 8c7e 4de1 635c 70e0 0200 0000 0000 0000  .~M.c\p.........
+00000230: deff d31c 0000 0000 e358 033c 68a0 2648  .........X.<h.&H
+00000240: a0c2 b833 aa9b b5ac 0200 0000 0000 0000  ...3............
 00000250: 8000 0000 8000 0000 86d2 54ab 0000 0000  ..........T.....
 00000260: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 00000270: 0000 0000 0000 0000 0000 0000 0000 0000  ................
@@ -63,10 +63,10 @@
 000003e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 000003f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 00000400: 4546 4920 5041 5254 0000 0100 5c00 0000  EFI PART....\...
-00000410: 094d 1d91 0000 0000 ffff d31c 0000 0000  .M..............
+00000410: ebf9 bb56 0000 0000 ffff d31c 0000 0000  ...V............
 00000420: 0100 0000 0000 0000 2200 0000 0000 0000  ........".......
-00000430: deff d31c 0000 0000 0075 d6a0 f872 0445  .........u...r.E
-00000440: 8c7e 4de1 635c 70e0 dfff d31c 0000 0000  .~M.c\p.........
+00000430: deff d31c 0000 0000 e358 033c 68a0 2648  .........X.<h.&H
+00000440: a0c2 b833 aa9b b5ac dfff d31c 0000 0000  ...3............
 00000450: 8000 0000 8000 0000 86d2 54ab 0000 0000  ..........T.....
 00000460: 0000 0000 0000 0000 0000 0000 0000 0000  ................
 00000470: 0000 0000 0000 0000 0000 0000 0000 0000  ................
[grimes](1) $ 

i am adding unit tests for GPT CRC now.

Got it fixed. Looks like we just need to supply 0 to crc32.