[Git][reproducible-builds/diffoscope][master] 3 commits: diffoscope/comparators/symlink.py: added a try except block to track

Vibhu Agrawal gitlab at salsa.debian.org
Tue Apr 2 12:59:18 CEST 2019



Vibhu Agrawal pushed to branch master at Reproducible Builds / diffoscope


Commits:
659d1917 by root at 2019-03-31T10:30:25Z
diffoscope/comparators/symlink.py: added a try except block to track
ENOSPC errors.
diffoscope/comparators/zip.py: added an except condition to track ENOSPC
errors.

Both the above changes were made to ensure diffoscope fails more
gracefully in case ENOSPC is hit. These changes were tested with a
small tmpfs. The files used for testing were initrd.img and
initrd.img.old for first case and two .aia files for second case.

Fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874582

- - - - -
d4a77886 by Vibhu at 2019-04-01T19:13:25Z
Merge branch 'master' of https://salsa.debian.org/reproducible-builds/diffoscope

- - - - -
465176e0 by Vibhu at 2019-04-01T19:24:07Z
Modified zip.py to handle ENOSPC

Added a try except block to handle OSError 28 and make the diffoscope
fail more gracefully.

- - - - -


2 changed files:

- diffoscope/comparators/symlink.py
- diffoscope/comparators/zip.py


Changes:

=====================================
diffoscope/comparators/symlink.py
=====================================
@@ -19,7 +19,9 @@
 
 import os
 import logging
+import sys
 
+from diffoscope.exc import ContainerExtractionError
 from diffoscope.tempfiles import get_named_temporary_file
 from diffoscope.difference import Difference
 
@@ -40,10 +42,20 @@ class Symlink(File):
         return os.readlink(self.name)
 
     def create_placeholder(self):
-        with get_named_temporary_file('w+', delete=False) as f:
-            f.write('destination: %s\n' % self.symlink_destination)
-            f.flush()
-            return f.name
+        
+        try:
+            with get_named_temporary_file('w+', delete=False) as f:
+                f.write('destination: %s\n' % self.symlink_destination)
+                f.flush()
+                return f.name
+
+        except OSError as ose:
+            if (ose.errno == 28):
+                sys.tracebacklimit = 0
+                raise ose
+
+            else:
+                raise   
 
     @property
     def path(self):


=====================================
diffoscope/comparators/zip.py
=====================================
@@ -152,6 +152,13 @@ class ZipContainer(Archive):
                 raise ContainerExtractionError(member_name, exc)
             raise
 
+        except OSError as ose:
+            if (ose.errno == 28):
+                sys.tracebacklimit = 0
+                raise ose
+            else:
+                raise 
+
     def get_member(self, member_name):
         zipinfo = self.archive.getinfo(member_name)
         if zipinfo.filename[-1] == '/':



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/822ca3f1b479c89bb086a08769ade19302aafa78...465176e0c1539dab6723a890edb40d17cde46563

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/822ca3f1b479c89bb086a08769ade19302aafa78...465176e0c1539dab6723a890edb40d17cde46563
You're receiving this email because of your account on salsa.debian.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190402/ce85e310/attachment.html>


More information about the rb-commits mailing list