fix: MINT-ZUSE says the stick was erased when it was (#168)
failed() printed "MINT-ZUSE: failed -- nothing changed" on every failure after YES, though by then gpt_write_one() had rewritten the stick's partition table and the identity partition's first blocks had been zeroed. gpt_write_one() now tells the two apart: GPT_EIO when its first write failed (nothing written), GPT_PART when a later write or flush failed (the disk is changed). MINT-ZUSE keeps "failed -- nothing changed" for GPT_EIO only, and says "failed -- the stick was erased; Zuse not minted" for every failure after the table is written. The marker is still written last. Tested first, seen to fail: qemu_session.py mint_part_fail (writes fail only at the identity partition's first sector, LBA 2048) -- "nothing changed", logs/20261112-122132. After: mint_part_fail PASS; mint_fail (every write fails) still "nothing changed", PASS; replace (the success path) PASS. Their logs here. FABRIC-3 XLVIII.20. Captain Bob, 2026-11-12: "start #168". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
+4
-2
@@ -352,14 +352,16 @@ int gpt_write_one(blkio_dev_t *disk, const uint8_t type[16], uint64_t part_secto
|
||||
* partition not yet written -- a used stick's old table included */
|
||||
{
|
||||
static const uint8_t zero[GPT_SECTOR];
|
||||
if (put_sectors(disk, 0u, zero, 1u) != 0 || disk->vt->flush(disk) != BLKIO_OK) return GPT_EIO;
|
||||
if (put_sectors(disk, 0u, zero, 1u) != 0) return GPT_EIO; /* nothing written yet */
|
||||
if (disk->vt->flush(disk) != BLKIO_OK) return GPT_PART; /* the MBR may be gone */
|
||||
}
|
||||
/* from here the disk is changed: any failure says so (#168) */
|
||||
if (put_sectors(disk, alt - GPT_ENT_SECTORS, g_gpt_new_entries, GPT_ENT_SECTORS) != 0 ||
|
||||
put_sectors(disk, alt, bak, 1u) != 0 ||
|
||||
put_sectors(disk, 2u, g_gpt_new_entries, GPT_ENT_SECTORS) != 0 ||
|
||||
put_sectors(disk, 1u, hdr, 1u) != 0 || disk->vt->flush(disk) != BLKIO_OK ||
|
||||
put_sectors(disk, 0u, mbr, 1u) != 0 || disk->vt->flush(disk) != BLKIO_OK)
|
||||
return GPT_EIO;
|
||||
return GPT_PART;
|
||||
return GPT_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user