Opened 8 years ago

Closed 8 years ago

#51930 closed defect (fixed)

diffoscope @54_0: mixes up Python 3 bytes and strings

Reported by: larryv (Lawrence Velázquez) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.3.99
Keywords: Cc:
Port: diffoscope

Description

% diffoscope zsh-5.2_0.darwin_15.x86_64.tbz2-*
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/__main__.py", line 177, in main
    sys.exit(run_diffoscope(parsed_args))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/__main__.py", line 148, in run_diffoscope
    parsed_args.file1, parsed_args.file2)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/comparators/__init__.py", line 94, in compare_root_paths
    file1 = specialize(FilesystemFile(path1, container=container1))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/comparators/__init__.py", line 175, in specialize
    if cls.recognizes(file):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/comparators/ps.py", line 38, in recognizes
    return PsFile.RE_FILE_TYPE.match(file.magic_file_type)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/comparators/binary.py", line 135, in magic_file_type
    self._magic_file_type = File.guess_file_type(self.path)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/diffoscope/comparators/binary.py", line 82, in guess_file_type
    return self._mimedb.from_file(path).decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
%

I’m assuming that self._mimedb.from_file(path) was expected to return a bytes object (or a Python 2 str object).

Change History (1)

comment:1 Changed 8 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: newclosed

Thanks for the report. I had noticed the same bug before and already submitted a patch upstream.

Should be fixed with diffoscope @56, r150794.

Note: See TracTickets for help on using tickets.