Hi, Pabs! Please try an attached patch! Hopefully, it'll solve this problem. :)
Thank you! Satyam Satyam Zode PICT, Pune On Mon, Mar 21, 2016 at 8:02 AM, Paul Wise <p...@debian.org> wrote: > Package: diffoscope > Version: 51 > Severity: normal > > I found a way to crash diffoscope with broken symlinks: > > pabs@chianamo ~ $ mkdir foo bar > pabs@chianamo ~ $ touch foo/baz > pabs@chianamo ~ $ ln -s asdasfahguwbagpiuasbdifgsabdf bar/baz > pabs@chianamo ~ $ diffoscope foo bar > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/diffoscope/__main__.py", line 177, in > main > sys.exit(run_diffoscope(parsed_args)) > File "/usr/lib/python3/dist-packages/diffoscope/__main__.py", line 148, in > run_diffoscope > parsed_args.file1, parsed_args.file2) > File "/usr/lib/python3/dist-packages/diffoscope/comparators/__init__.py", > line 92, in compare_root_paths > return compare_directories(path1, path2) > File "/usr/lib/python3/dist-packages/diffoscope/comparators/directory.py", > line 104, in compare_directories > return FilesystemDirectory(path1).compare(FilesystemDirectory(path2)) > File "/usr/lib/python3/dist-packages/diffoscope/comparators/directory.py", > line 157, in compare > my_file, other_file, source=name) > File "/usr/lib/python3/dist-packages/diffoscope/comparators/__init__.py", > line 102, in compare_files > if file1.has_same_content_as(file2): > File "/usr/lib/python3/dist-packages/diffoscope/__init__.py", line 143, in > tool_check > return original_function(*args, **kwargs) > File "/usr/lib/python3/dist-packages/diffoscope/comparators/binary.py", > line 186, in has_same_content_as > other_size = os.path.getsize(other.path) > File "/usr/lib/python3.5/genericpath.py", line 50, in getsize > return os.stat(filename).st_size > FileNotFoundError: [Errno 2] No such file or directory: 'bar/baz' > > -- System Information: > Debian Release: stretch/sid > APT prefers testing > APT policy: (900, 'testing'), (860, 'testing-proposed-updates'), (850, > 'buildd-testing-proposed-updates'), (800, 'unstable'), (790, > 'buildd-unstable'), (700, 'experimental'), (690, 'buildd-experimental'), > (500, 'unstable-debug'), (1, 'experimental-debug') > Architecture: amd64 (x86_64) > > Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores) > Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) > > Versions of packages diffoscope depends on: > ii python3-libarchive-c 2.1-3 > ii python3-magic 1:5.25-2 > ii python3-pkg-resources 18.8-1 > pn python3:any <none> > > Versions of packages diffoscope recommends: > ii acl 2.2.52-3 > ii binutils-multiarch 2.26-5 > ii bzip2 1.0.6-8 > ii caca-utils 0.99.beta19-2+b1 > ii colord 1.2.12-1 > ii cpio 2.11+dfsg-5 > pn default-jdk | java-sdk <none> > ii enjarify 20151118-1 > ii fontforge-extras 0.3-4 > pn fp-utils <none> > ii genisoimage 9:1.1.11-3 > ii gettext 0.19.7-2 > ii ghc 7.10.3-7 > ii ghostscript 9.18~dfsg-4 > ii gnupg 1.4.20-4 > pn mono-utils <none> > ii pdftk 2.02-3 > ii poppler-utils 0.38.0-2 > ii python3-debian 0.1.27 > pn python3-guestfs <none> > ii python3-rpm 4.12.0.1+dfsg1-3+b2 > ii python3-tlsh 3.4.4+20151206-1+b1 > ii rpm2cpio 4.12.0.1+dfsg1-3+b2 > ii sng 1.1.0-1 > ii sqlite3 3.11.1-1 > ii squashfs-tools 1:4.3-3 > ii unzip 6.0-20 > ii vim-common 2:7.4.963-1+b2 > ii xz-utils 5.1.1alpha+20120614-2.1 > > Versions of packages diffoscope suggests: > ii libjs-jquery 1.11.3+dfsg-4 > > -- no debconf information > > -- > bye, > pabs > > https://wiki.debian.org/PaulWise > > > > _______________________________________________ > Reproducible-builds mailing list > reproducible-bui...@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds
From 3e9aea18767099dffe62c14e7215aed54347a10f Mon Sep 17 00:00:00 2001 From: Satyam Zode <satyamz...@gmail.com> Date: Mon, 21 Mar 2016 23:12:55 +0530 Subject: [PATCH 1/2] fixed issue related to diffoscope symlinks crashing --- diffoscope/comparators/binary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffoscope/comparators/binary.py b/diffoscope/comparators/binary.py index 9663214..5622a9c 100644 --- a/diffoscope/comparators/binary.py +++ b/diffoscope/comparators/binary.py @@ -183,7 +183,7 @@ class File(object, metaclass=ABCMeta): logger.debug('%s has_same_content %s', self, other) # try comparing small files directly first my_size = os.path.getsize(self.path) - other_size = os.path.getsize(other.path) + other_size = os.lstat(other.path).st_size if my_size == other_size and my_size <= SMALL_FILE_THRESHOLD: if open(self.path, 'rb').read() == open(other.path, 'rb').read(): return True -- 2.1.4