Skip to content

xfig xfig_ref_en.pdf crashes diffoscope

The xfig-doc package contains a PDF that crashes diffoscope with some differences:

Running in a recent Debian sid chroot:

$ diffoscope --version
diffoscope 220

$ diffoscope *-xfig-doc/usr/share/doc/xfig/xfig_ref_en.pdf
                                                                                  
Traceback (most recent call last):                                                                                                      
  File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 766, in main                                                           
    sys.exit(run_diffoscope(parsed_args))                                                                                               
  File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 717, in run_diffoscope                                                 
    difference = compare_root_paths(path1, path2)                                                                                       
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/compare.py", line 69, in compare_root_paths                         
    difference = compare_files(file1, file2)                                                                                            
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/compare.py", line 149, in compare_files                             
    return file1.compare(file2, source)                                                                                                 
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/file.py", line 515, in compare                                          difference = self._compare_using_details(other, source)                                                                             
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/file.py", line 416, in _compare_using_details                       
    details.extend(self.compare_details(other, source))                                                                                 
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/pdf.py", line 78, in compare_details                                      
    self.dump_pypdf2_annotations(self),                                                                                                 
  File "/usr/lib/python3/dist-packages/diffoscope/comparators/pdf.py", line 123, in dump_pypdf2_annotations                             
    for x in range(pdf.getNumPages()):                                                                                                  
  File "/usr/lib/python3/dist-packages/PyPDF2/_reader.py", line 404, in getNumPages                                                     
    return self._get_num_pages()                                                                                                        
  File "/usr/lib/python3/dist-packages/PyPDF2/_reader.py", line 394, in _get_num_pages                                                  
    self._flatten()                                                                                                                     
  File "/usr/lib/python3/dist-packages/PyPDF2/_reader.py", line 1044, in _flatten                                                       
    self._flatten(page.get_object(), inherit, **addt)                                                                                   
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 252, in get_object                                                      
    obj = self.pdf.get_object(self)                                                                                                     
  File "/usr/lib/python3/dist-packages/PyPDF2/_reader.py", line 1152, in get_object                                                     
    retval = read_object(self.stream, self)  # type: ignore                                                                             
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 1337, in read_object
    return DictionaryObject.read_from_stream(stream, pdf, forced_encoding)
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 799, in read_from_stream
    value = read_object(stream, pdf, forced_encoding)
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 1337, in read_object
    return DictionaryObject.read_from_stream(stream, pdf, forced_encoding)
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 799, in read_from_stream
    value = read_object(stream, pdf, forced_encoding)
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 1337, in read_object
    return DictionaryObject.read_from_stream(stream, pdf, forced_encoding)
  File "/usr/lib/python3/dist-packages/PyPDF2/generic.py", line 809, in read_from_stream
    raise PdfReadError(msg)
PyPDF2.errors.PdfReadError: Multiple definitions in dictionary at byte 0x19614a for key /I158

This was a build of the xfig source package using:

reprotest --verbose --store-dir=/home/vagrant/xfig.20220812.rNEZxJ --min-cpus=1 --vary=-user_group,-domain_host,-fileordering,-time auto -- null

Attached is a tarball of the two .pdf files: xfig_ref_en-pdfs.tar.zst

Edited by Chris Lamb
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information