pycdlib icon indicating copy to clipboard operation
pycdlib copied to clipboard

Check continuation block to detect Rock Ridge version

Open danigm opened this issue 4 months ago • 2 comments

This patch moves the _set_rock_ridge method call after the continuation is parsed and sets the max version detected between dr_entries and ce_entries.

This issue was detected parsing new openSUSE Tumbleweed iso. Looks like mkisofs starts using continuation area ('CE') blobs if file name length is > 92 and PX record could be there, affecting the version detection: https://bugzilla.suse.com/show_bug.cgi?id=1209983#c15

danigm avatar Aug 28 '25 11:08 danigm

This is the code used to reproduce the error reported:

#!/usr/bin/python3.13

import sys
import pycdlib

iso = pycdlib.PyCdlib()
iso.open(sys.argv[1])

for child in iso.list_children(iso_path='/'):
    print(child.file_identifier())

iso.close()

When run with the latest Tumbleweed iso https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Current.iso.

Run with master version:

(env) [danigm@hex pycdlib]!master $ ./reproducer.py /home/danigm/Downloads/suse/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20250826-Media.iso 
Traceback (most recent call last):
  File "/home/danigm/Projects/suse/tmp/pycdlib/./reproducer.py", line 7, in <module>
    iso.open(sys.argv[1])
    ~~~~~~~~^^^^^^^^^^^^^
  File "/home/danigm/Projects/suse/tmp/pycdlib/pycdlib/pycdlib.py", line 4066, in open
    self._open_fp(fp)
    ~~~~~~~~~~~~~^^^^
  File "/home/danigm/Projects/suse/tmp/pycdlib/pycdlib/pycdlib.py", line 2235, in _open_fp
    ic_level, lastbyte = self._walk_directories(self.pvd, extent_to_ptr,
                         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
                                                extent_to_inode, le_ptrs)
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danigm/Projects/suse/tmp/pycdlib/pycdlib/pycdlib.py", line 1055, in _walk_directories
    self._set_rock_ridge(rr)
    ~~~~~~~~~~~~~~~~~~~~^^^^
  File "/home/danigm/Projects/suse/tmp/pycdlib/pycdlib/pycdlib.py", line 941, in _set_rock_ridge
    raise pycdlibexception.PyCdlibInvalidISO('Inconsistent Rock Ridge versions on the ISO!')
pycdlib.pycdlibexception.PyCdlibInvalidISO: Inconsistent Rock Ridge versions on the ISO!

Run with patched version:

(env) [danigm@hex pycdlib]!rock-ridge-version-detection $ ./reproducer.py /home/danigm/Downloads/suse/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20250826-Media.iso 
b'.'
b'..'
b'BOOT'
b'CHECKSUM.;1'
b'CHECKSUM.ASC;1'
b'DOCU'
b'EFI'
b'GPG_P000.ASC;1'
b'GPG_P001.ASC;1'
b'GPG_P002.ASC;1'
b'GPG_PUBK.ASC;1'
b'GPLV2.TXT;1'
b'GPLV3.TXT;1'
b'MEDIA.1'
b'NOARCH'
b'README.;1'
b'REPODATA'
b'SUSEGO.ICO;1'
b'SUSEGO.PNG;1'
b'SUSEGO.SVG;1'
b'X86_64'
b'_TREEINF.;1'

danigm avatar Aug 28 '25 11:08 danigm

I encountered this error as well and need this fix. When will it be merged? Thanks

ZouYuhua avatar Sep 16 '25 08:09 ZouYuhua