[Bug 286666] Failed to rebuild autoinstall ISO for freebsd-14.3-BETA1-64bit with error: Unused fields should be 0

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 09 May 2025 19:20:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286666

--- Comment #4 from Ed Maste <emaste@freebsd.org> ---
It looks like this is a pycdlib bug.

Here is a hexdump of the ISO content from the offending extent
$ dd if=FreeBSD-14.3-BETA1-amd64-dvd1.iso bs=2k iseek=1756652 | hexdump -Cv
...
000b7800  a8 00 56 d4 1a 00 00 1a  d4 56 08 0a 00 00 00 00  |..V......V......|
000b7810  0a 08 7d 05 02 0c 2f 34  00 00 00 00 01 00 00 01  |..}.../4........|
000b7820  1e 53 53 4c 5f 53 45 53  53 49 4f 4e 5f 47 45 54  |.SSL_SESSION_GET|
000b7830  30 5f 54 49 43 4b 45 54  2e 33 5f 47 5a 3b 31 00  |0_TICKET.3_GZ;1.|
000b7840  50 58 2c 01 24 81 00 00  00 00 81 24 03 00 00 00  |PX,.$......$....|
000b7850  00 00 00 03 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000b7860  00 00 00 00 58 41 00 00  00 00 41 58 54 46 1a 01  |....XA....AXTF..|
000b7870  0e 7d 05 02 0c 2f 34 00  7d 05 02 0c 2f 34 00 7d  |.}.../4.}.../4.}|
000b7880  05 02 0c 30 08 00 4e 4d  21 01 00 53 53 4c 5f 53  |...0..NM!..SSL_S|
000b7890  45 53 53 49 4f 4e 5f 67  65 74 30 5f 74 69 63 6b  |ESSION_get0_tick|
000b78a0  65 74 2e 33 2e 67 7a 00  b2 00 9b d3 1a 00 00 1a  |et.3.gz.........|
000b78b0  d3 9b a0 10 00 00 00 00  10 a0 7d 05 02 0c 2f 33  |..........}.../3|
...

pycdlib's XARecord::parse does:

        # In a "typical" XA record, the record immediately follows the DR
        # record (but comes before the Rock Ridge record, if this is a Rock
        # Ridge ISO).  However, we have seen ISOs (Windows 98 SE) that put some
        # padding between the end of the DR record and the XA record.  As far
        # as I can tell, that padding is the size of the file identifier,
        # but rounded up to the nearest even number.  We check both places for
        # the XA record.
        for offset in (0, even_size):
            parse_str = xastr[offset:]
            if len(parse_str) < struct.calcsize(self.FMT):
                return False

            (self._group_id, self._user_id, self._attributes, signature,
             self._filenum, unused) = struct.unpack_from(self.FMT, parse_str,
0)
            if signature != b'XA':
                continue

            if unused != b'\x00\x00\x00\x00\x00':
                print("offset=" + str(offset))
                print(" ".join(f"{byte:02x}" for byte in unused))
                raise pycdlibexception.PyCdlibInvalidISO('Unused fields should
be 0')

            self._pad_size = offset
            break

The "PX" at 000b7840 is the beginning of the Rock Ridge entry (PX is the POSIX
attributes record). XARecord::parse is called before parsing the RR entry, and
happens to find the two bytes "XA" in the RR entry (in this case, the
inode/serial number 0x4158).

-- 
You are receiving this mail because:
You are the assignee for the bug.