[Reproducible-builds] Bug#818856: Bug#818856: diffoscope: crashes on broken symlinks

2016-04-06 Thread Paul Wise
On Thu, 2016-04-07 at 00:42 +0530, Satyam Zode wrote:

> Thank you for reviewing patch. I have made all the changes you
> mentioned above. Please find an attachment :-)

This will works better but will still give a crash when both symlinks
are broken and point to a filename of the same length; because open()
throws an IOError exception when it tries to open a broken symlink.

In addition, I think we need a test for this issue written before
fixing the issue, here are some test cases I can think of:

one broken symlink, one file

one file, one broken symlink
one broken symlink, one dir

one dir, one broken symlink
one working symlink to a file, one broken symlink
one broken symlink, one working symlink to a file
one working symlink to a dir, one broken symlink
one broken symlink, one
working symlink to a dir
two broken symlinks pointing at the same
location
two broken symlinks of the same size but different locations
two broken symlinks of different sizes

-- 
bye,
pabs

https://wiki.debian.org/PaulWise




signature.asc
Description: This is a digitally signed message part
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Re: [Reproducible-builds] Bug#818856: Bug#818856: diffoscope: crashes on broken symlinks

2016-04-06 Thread Satyam Zode
Hi Reiner!
I did some trivial changes. Please find an attached patch.
This patch closes #818856 and #796262.

Thanks!
Satyam Zode
From 85c062d32b84ed6d8fcf5a80f0d2a2fbb4e43e54 Mon Sep 17 00:00:00 2001
From: Satyam Zode 
Date: Thu, 7 Apr 2016 01:15:04 +0530
Subject: [PATCH] Fixed issue related to diffoscope symlinks crashing (Closes:
 #818856,#796262)

---
 diffoscope/comparators/binary.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/binary.py b/diffoscope/comparators/binary.py
index 9663214..2b61538 100644
--- a/diffoscope/comparators/binary.py
+++ b/diffoscope/comparators/binary.py
@@ -182,8 +182,8 @@ class File(object, metaclass=ABCMeta):
 def has_same_content_as(self, other):
 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)
+my_size = os.lstat(self.path).st_size
+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

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds