clalancette / pycdlib

Python library to read and write ISOs
GNU Lesser General Public License v2.1
143 stars 38 forks source link

Parsing PS3 ISO images failes with exception #98

Open sahlberg opened 2 years ago

sahlberg commented 2 years ago

I rip my PS3 disks into ISO on my custom firmware PS3. I wrote a small tool using pycdlib to extract the DISC-ID number from the ISO (stored in the file /PS3_GAME/PARAM.SFO) however pycdlib fails to parse these iso images and fails with the exception:

Traceback (most recent call last): File "/data/sahlberg/pop-fe/./ps3discid.py", line 23, in iso.open(path) File "/home/sahlberg/.local/lib/python3.10/site-packages/pycdlib/pycdlib.py", line 4123, in open self._open_fp(fp) File "/home/sahlberg/.local/lib/python3.10/site-packages/pycdlib/pycdlib.py", line 2394, in _open_fp self._parse_udf_descriptors() File "/home/sahlberg/.local/lib/python3.10/site-packages/pycdlib/pycdlib.py", line 2083, in _parse_udf_descriptors raise pycdlibexception.PyCdlibInvalidISO('UDF File Set Tag identifier not 256') pycdlib.pycdlibexception.PyCdlibInvalidISO: UDF File Set Tag identifier not 256

In this case it is because the tag in question has the value 261, not 256.

A quick fix for me was to just edit pycdlib.py and comment out these lines: elif ident == b'BEA01': self._has_udf = False

self._has_udf = True

                #udf_bea = udfmod.BEAVolumeStructure()
                #udf_bea.parse(vd, curr_extent)
                #self.udf_beas.append(udf_bea)

(I don't care about UDF much, I just want to read the PARAM.SFO file from the ISO)

Is this something you can fix? If not, is it possible to add a method to the class to disable all UDF parsing for an ISO to handle cases like mine where there are UDF tags that the library can not handle?

I am on Fedora36 and this is the version installed: $ head pycdlib-1.13.0.dist-info/METADATA Metadata-Version: 2.1 Name: pycdlib Version: 1.13.0 Summary: Pure python ISO manipulation library Home-page: http://github.com/clalancette/pycdlib Author: Chris Lalancette Author-email: clalancette@gmail.com License: LGPLv2 Keywords: iso9660 iso ecma119 rockridge joliet eltorito udf Platform: UNKNOWN

(These ISO images were created by the PS3 CFW tool MultiMan ripping a PS3 DVD so may be difficult to reproduce without access to a PS3.)

clalancette commented 1 year ago

I'm sorry it's been a month and no response on this.

I'd very much prefer to fix this problem, rather than disabling UDF parsing. Is there any way you can make an example ISO available to me so I can download it and try to figure out what is wrong with pycdlib parsing of it? Thanks

sahlberg commented 1 year ago

I can make an ISO available with this. The smallest one I have is ~2Gbyte. Let me know how/where I can upload it to you.

Please contact me on ronniesahlberg@gmail.com with details and I can try to get the ISO to you