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

Reiner Herrmann reiner at reiner-h.de
Sat Apr 2 23:26:34 UTC 2016

Hi Satyam!

Thanks for submitting a patch for this issue!

On Sun, Apr 03, 2016 at 02:08:52AM +0530, Satyam Zode wrote:
>          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

Here you change only the other_size line, not my_size.
When other.path is a broken symlink, this will work (and diffoscope
doesn't crash).
But self.path could also be a broken symlink (if you reverse the
diffoscope arguments, `diffoscope bar foo`). In this case diffoscope
would crash with the same problem.

Can you please amend your patch to fix this also?

Kind regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/reproducible-builds/attachments/20160403/22f497bf/attachment-0001.sig>

More information about the Reproducible-builds mailing list