robmcmullen / atrcopy

Command line utility to manage file systems on Atari 8-bit and Apple ][ disk images.
Mozilla Public License 2.0
24 stars 8 forks source link

Program crash on some ATR files #6

Closed a8bit closed 6 years ago

a8bit commented 6 years ago

I have 595 ATR files that atrcopy wont open at all. Mostly non-english, there are a few english language disks in there too, here is an example crash. They all seem to work OK in an emulator.

>atrcopy /Users/steve/Emulation/A8/old_.atr/ABBUC\ Magazin\ \#44\ \(1996\)\(ABBUC\)\(Side\ A\).atr Traceback (most recent call last): File "/usr/local/bin/atrcopy", line 6, in <module> atrcopy.run() File "/usr/local/lib/python2.7/site-packages/atrcopy/__init__.py", line 548, in run parser = find_diskimage(disk_image_name) File "/usr/local/lib/python2.7/site-packages/atrcopy/__init__.py", line 68, in find_diskimage parser = guess_parser_for_mime(mime, rawdata, options.verbose) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 162, in guess_parser_for_mime found = parser(r, True) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 30, in __init__ self.parse() File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 72, in parse self.image = self.get_image(r) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 82, in get_image return self.image_type(r) File "/usr/local/lib/python2.7/site-packages/atrcopy/ataridos.py", line 446, in __init__ DiskImageBase.__init__(self, *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 115, in __init__ self.setup() File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 156, in setup self.get_metadata() File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 161, in get_metadata self.get_directory() File "/usr/local/lib/python2.7/site-packages/atrcopy/ataridos.py", line 549, in get_directory log.debug("dirent %d not sane: %s" % (num, dirent)) File "/usr/local/lib/python2.7/site-packages/atrcopy/ataridos.py", line 106, in __str__ return "File #%-2d (%s) %03d %-8s%-3s %03d" % (self.file_num, self.summary, self.starting_sector, self.basename.decode("utf-8"), self.ext.decode("utf-8"), self.num_sectors) File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 0: invalid start byte ABBUC Magazin #44 (1996)(ABBUC)(Side A).atr.zip

Here's another one with a different crash. atrcopy /Users/steve/Emulation/A8/old_.atr/Jewels\ of\ Darkness\ \#2\ -\ Adventure\ Quest\ \(1983\)\ \(Level\ 9\ Computing\)\ \(GB\)\ .atr Traceback (most recent call last): File "/usr/local/bin/atrcopy", line 6, in <module> atrcopy.run() File "/usr/local/lib/python2.7/site-packages/atrcopy/__init__.py", line 548, in run parser = find_diskimage(disk_image_name) File "/usr/local/lib/python2.7/site-packages/atrcopy/__init__.py", line 68, in find_diskimage parser = guess_parser_for_mime(mime, rawdata, options.verbose) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 162, in guess_parser_for_mime found = parser(r, True) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 30, in __init__ self.parse() File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 72, in parse self.image = self.get_image(r) File "/usr/local/lib/python2.7/site-packages/atrcopy/parsers.py", line 82, in get_image return self.image_type(r) File "/usr/local/lib/python2.7/site-packages/atrcopy/spartados.py", line 119, in __init__ AtariDosDiskImage.__init__(self, *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/atrcopy/ataridos.py", line 446, in __init__ DiskImageBase.__init__(self, *args, **kwargs) File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 115, in __init__ self.setup() File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 156, in setup self.get_metadata() File "/usr/local/lib/python2.7/site-packages/atrcopy/diskimages.py", line 161, in get_metadata self.get_directory() File "/usr/local/lib/python2.7/site-packages/atrcopy/spartados.py", line 177, in get_directory d = SpartaDosDirent(self, 0, bytes[0:23], starting_sector=self.root_dir) File "/usr/local/lib/python2.7/site-packages/atrcopy/spartados.py", line 30, in __init__ AtariDosDirent.__init__(self, image, file_num, bytes=bytes) File "/usr/local/lib/python2.7/site-packages/atrcopy/ataridos.py", line 102, in __init__ self.parse_raw_dirent(image, bytes) File "/usr/local/lib/python2.7/site-packages/atrcopy/spartados.py", line 70, in parse_raw_dirent self.filename = str(values['filename']).rstrip() AttributeError: can't set attribute Jewels of Darkness #2 - Adventure Quest (1983) (Level 9 Computing) (GB) .atr.zip

robmcmullen commented 6 years ago

Thanks for the examples. The first looks like a Unicode problem, which is an issue that I need to work on. I'll definitely look at this. Would you mind sending some more disk images that have that same unicode problem so I can check and make sure the fix works in the general case?

It looks like the second was identified as a SpartaDos disk? SpartaDos is complicated and I just have a rudimentary bit of support for it. This issue may remain for a while, just because it's not very high on my priority list. If I ever do get SpartaDos implemented, it will probably be read-only.

a8bit commented 6 years ago

Here's a few that give me utf8 errors utf8 fails.zip

Yes the Adventure quest one is a spartados disk, I managed to get this snap as it flashed on screen.

atari013

I noticed the mentions of spartados in the crash report and knew it was #2 on your list of things to do. Having the app recognise the file as a spartados one and exit gracefully rather than crash would be a plus ;) It would be nice if it would do that for DCM too!

At the moment I'm only running the tool in list mode, just to identify the types of images I have, I haven't started looking through to see whats on the disks yet!

robmcmullen commented 6 years ago

Yes, less crashy would be good. :) I'll work on that. DCM support is actually issue #1 but I've not had time yet. A helpful error message would also be good.