Commit 659d1917 authored by root's avatar root

diffoscope/comparators/ added a try except block to track

ENOSPC errors.
diffoscope/comparators/ added an except condition to track ENOSPC

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.

parent b2b61327
......@@ -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,11 +42,21 @@ class Symlink(File):
return os.readlink(
def create_placeholder(self):
with get_named_temporary_file('w+', delete=False) as f:
f.write('destination: %s\n' % self.symlink_destination)
except OSError as ose:
if (ose.errno == 28):
sys.tracebacklimit = 0
raise ose
def path(self):
if not hasattr(self, '_placeholder'):
......@@ -152,6 +152,14 @@ class ZipContainer(Archive):
raise ContainerExtractionError(member_name, exc)
except OSError as ose:
if (ose.errno == 28):
sys.tracebacklimit = 0
raise ose
def get_member(self, member_name):
zipinfo = self.archive.getinfo(member_name)
if zipinfo.filename[-1] == '/':
  • @Vibhu-guest also I'm reverting this one, mostly because the authoring information is screwed (root <root@localhost.localdomain> - does this mean you are doing your work as root??), and should have probably be gone through an MR instead of being pushed to master.

    I'm also at odds about the changes themselves. You are catching that OSError in those two fairly specific positions, but it feels rather arbitrary. Surely ENOSPC could happen anywhere?

    Finally, I think the user at the end should at least getting something that tells them what the problem is. I think this way the program terminates without printing anything?

  • mentioned in commit 269864b7

    Toggle commit list
  • As far as I could understand, ENOSPC was occurring due to no space left to create tempfiles. As I was testing with different types of files, I used two .deb files for which the source of error was the Similarly using .aia files was raising error from

    So to handle these particular cases, I modified the above mentioned two files.

    However, if you recommend finding a more generic solution, then I will look through it again.

    For the last part, using try-except does raise a final error showing end of space, but the traceback is not shown.

    Also, I will be more careful about the authoring information now onwards.

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment