morituri icon indicating copy to clipboard operation
morituri copied to clipboard

moritori wrote a config file which leads to UnicodeDecodeError: 'utf8' codec can't decode byte 0xb6 in position 7: invalid start byte

Open derobert opened this issue 10 years ago • 2 comments

I'm using a Plextor PX-40TS. This is a SCSI device. (Yes, actually SCSI. Not just IDE/SATA pretending to be SCSI.)

I ran $ rip offset find -d /dev/sg0 -o 676 and it finally told me it was adding the offset to the config file, after ripping verifying each track. The config file looks like this:

[drive:%0B%B6%3A%09%15%06R%B7%FC%0F%C1%BF%40%5C%5D%09%3A%E5%10%08%8C]
vendor = �
model = R���@\]
release = �
read_offset = 676

That probably won't come through right, so:

$ xxd .config/morituri/morituri.conf 
0000000: 5b64 7269 7665 3a25 3042 2542 3625 3341  [drive:%0B%B6%3A
0000010: 2530 3925 3135 2530 3652 2542 3725 4643  %09%15%06R%B7%FC
0000020: 2530 4625 4331 2542 4625 3430 2535 4325  %0F%C1%BF%40%5C%
0000030: 3544 2530 3925 3341 2545 3525 3130 2530  5D%09%3A%E5%10%0
0000040: 3825 3843 5d0a 7665 6e64 6f72 203d 20b6  8%8C].vendor = .
0000050: 0a6d 6f64 656c 203d 2015 0652 b7fc 0fc1  .model = ..R....
0000060: bf40 5c5d 0a72 656c 6561 7365 203d 20e5  .@\].release = .
0000070: 1008 8c0a 7265 6164 5f6f 6666 7365 7420  ....read_offset 
0000080: 3d20 3637 360a 0a                        = 676..

Most rip commands now crash:

$ rip
Traceback (most recent call last):
  File "/usr/bin/rip", line 41, in <module>
    sys.exit(main.main(sys.argv[1:]))
  File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 45, in main
    ret = c.parse(argv)
  File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 123, in parse
    logcommand.LogCommand.parse(self, argv)
  File "/usr/lib/python2.7/dist-packages/morituri/extern/command/command.py", line 325, in parse
    ret = self.handleOptions(self.options)
  File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 119, in handleOptions
    self.config = config.Config()
  File "/usr/lib/python2.7/dist-packages/morituri/common/config.py", line 43, in __init__
    self.open()
  File "/usr/lib/python2.7/dist-packages/morituri/common/config.py", line 52, in open
    self._parser.readfp(f)
  File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
    self._read(fp, filename)
  File "/usr/lib/python2.7/ConfigParser.py", line 479, in _read
    line = fp.readline()
  File "/usr/lib/python2.7/codecs.py", line 672, in readline
    return self.reader.readline(size)
  File "/usr/lib/python2.7/codecs.py", line 527, in readline
    data = self.read(readsize, firstline=True)
  File "/usr/lib/python2.7/codecs.py", line 474, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb6 in position 7: invalid start byte

Whatever moritori is using to get the drive info is failing horribly with actual SCSI drives. It's fully possible to get info from the drive:

$ sginfo /dev/sg0 
INQUIRY response (cmd: 0x12)
----------------------------
Device Type                        5
Vendor:                    PLEXTOR
Product:                   CD-ROM PX-40TS
Revision level:            1.12

derobert avatar Dec 27 '14 11:12 derobert

Could you delete the config file and rerun the command but this time with RIP_DEBUG=5 in the environment, and saving it to a file, and sending it to me?

Also just send me the morituri.conf it generates.

I'll take a look why this could be happening.

Thomas

On 12/27/2014 06:28 AM, Anthony DeRobertis wrote:

I'm using a Plextor PX-40TS. This is a SCSI device. (Yes, actually SCSI. Not just IDE/SATA pretending to be SCSI.)

I ran |$ rip offset find -d /dev/sg0 -o 676| and it finally told me it was adding the offset to the config file, after ripping verifying each track. The config file looks like this:

|[drive:%0B%B6%3A%09%15%06R%B7%FC%0F%C1%BF%40%5C%5D%09%3A%E5%10%08%8C] vendor = � model = R���@] release = � read_offset = 676 |

That probably won't come through right, so:

|$ xxd .config/morituri/morituri.conf 0000000: 5b64 7269 7665 3a25 3042 2542 3625 3341 [drive:%0B%B6%3A 0000010: 2530 3925 3135 2530 3652 2542 3725 4643 %09%15%06R%B7%FC 0000020: 2530 4625 4331 2542 4625 3430 2535 4325 %0F%C1%BF%40%5C% 0000030: 3544 2530 3925 3341 2545 3525 3130 2530 5D%09%3A%E5%10%0 0000040: 3825 3843 5d0a 7665 6e64 6f72 203d 20b6 8%8C].vendor = . 0000050: 0a6d 6f64 656c 203d 2015 0652 b7fc 0fc1 .model = ..R.... 0000060: bf40 5c5d 0a72 656c 6561 7365 203d 20e5 .@].release = . 0000070: 1008 8c0a 7265 6164 5f6f 6666 7365 7420 ....read_offset 0000080: 3d20 3637 360a 0a = 676.. |

Most |rip| commands now crash:

|$ rip Traceback (most recent call last): File "/usr/bin/rip", line 41, in sys.exit(main.main(sys.argv[1:])) File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 45, in main ret = c.parse(argv) File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 123, in parse logcommand.LogCommand.parse(self, argv) File "/usr/lib/python2.7/dist-packages/morituri/extern/command/command.py", line 325, in parse ret = self.handleOptions(self.options) File "/usr/lib/python2.7/dist-packages/morituri/rip/main.py", line 119, in handleOptions self.config = config.Config() File "/usr/lib/python2.7/dist-packages/morituri/common/config.py", line 43, in init self.open() File "/usr/lib/python2.7/dist-packages/morituri/common/config.py", line 52, in open self._parser.readfp(f) File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp self._read(fp, filename) File "/usr/lib/python2.7/ConfigParser.py", line 479, in _read line = fp.readline() File "/usr/lib/python2.7/codecs.py", line 672, in readline return self.reader.readline(size) File "/usr/lib/python2.7/codecs.py", line 527, in readline data = self.read(readsize, firstline=True) File "/usr/lib/python2.7/codecs.py", line 474, in read newchars, decodedbytes = self.decode(data, self.errors) UnicodeDecodeError: 'utf8' codec can't decode byte 0xb6 in position 7: invalid start byte |

Whatever moritori is using to get the drive info is failing horribly with actual SCSI drives. It's fully possible to get info from the drive:

|$ sginfo /dev/sg0

INQUIRY response (cmd: 0x12)

Device Type 5 Vendor: PLEXTOR Product: CD-ROM PX-40TS Revision level: 1.12 |

— Reply to this email directly or view it on GitHub https://github.com/thomasvs/morituri/issues/102.

thomasvs avatar Dec 29 '14 16:12 thomasvs

On 12/29/2014 11:35 AM, thomasvs wrote:

Could you delete the config file and rerun the command but this time with RIP_DEBUG=5 in the environment, and saving it to a file, and sending it to me?

Both are attached. Note that I compressed the logfile with xz, as the uncompressed log is several hundred MB.

derobert avatar Dec 30 '14 06:12 derobert