Fay Stegerman wrote:

> Am I missing something here?  Because diffoscope 274 is already in trixie.  
> And
> the issue isn't a result of a change to diffoscope itself but a result of
> python3-cryptography […]

That is essentially my reading of the situation. Here's what I just
committed which also refs 

  commit c1aa6259cd1954182a02ede393c3540dcda33a11
  Author: Chris Lamb <la...@debian.org>
  Date:   Sun Aug 18 18:22:31 2024 +0100
  
      Also catch RuntimeError when importing PyPDF so that PyPDF or,
      crucially, its transitive dependencies do not cause diffoscope
      to traceback at runtime and build time. (Closes:
      Debian:#1078944, reproducible-builds/diffoscope#389)
      
      The root or even primary cause of this bug is not in diffoscope itself; 
rather,
      the cause is to be found between src:python3-cryptography and src:openssl 
— see
      bugs #1078747 and #965041 for more details.
      
      However, diffoscope should (and easily can…) be mindful that importing 
external
      libraries could result in exceptions other than ImportError when we have 
reason
      to believe that they might do so.
      
      We already do so in fsimage.py for a complicated library (guestfs), so I 
think
      it's not at all unreasonable to catch it here, too.
      
      Alas I can't seem to reproduce this on my local machine or in a clean sid
      chroot, so I am uploading the following patch after simply having a hard 
stare
      at the code… albeit on a warm Sunday afternoon.

  diff --git a/diffoscope/comparators/pdf.py b/diffoscope/comparators/pdf.py
  index 7584ae0c..30a6f803 100644
  --- a/diffoscope/comparators/pdf.py
  +++ b/diffoscope/comparators/pdf.py
  @@ -72,7 +72,7 @@ try:
               # PyPDF 1.x
               from PyPDF2.utils import PdfReadError
   
  -except ImportError:  # noqa
  +except (ImportError, RuntimeError):  # noqa
       python_module_missing("pypdf")
       pypdf = None
   
  diff --git a/tests/comparators/test_pdf.py b/tests/comparators/test_pdf.py
  index 25423a5d..738bf95e 100644
  --- a/tests/comparators/test_pdf.py
  +++ b/tests/comparators/test_pdf.py
  @@ -42,7 +42,7 @@ def skip_unless_pypdf3():
       def fn():
           try:
               import pypdf
  -        except ImportError:
  +        except (ImportError, RuntimeError):
               return True
   
           return not pypdf.__version__.startswith("3.")


Regards,

-- 
      o
    ⬋   ⬊      Chris Lamb
   o     o     reproducible-builds.org 💠
    ⬊   ⬋
      o

Reply via email to