Crash on hardlink in an ISO
If an ISO contains a hardlink, diffoscope crashes in list_libarchive
when processing the hardlink as entry.size
is None
and so the {size_or_dev:>8}
formatting fails:
File "/srv/diffoscope/diffoscope/comparators/utils/libarchive.py", line 164, in list_libarchive
yield "{strmode} {entry.nlink:>3} {user:>8} {group:>8} {size_or_dev:>8} {mtime:>8} {name_and_link}\n".format(
TypeError: unsupported format string passed to NoneType.__format__
It looks like this is expected behaviour in libarchive. It's also easily reproducible:
mkdir diffoscope-crasher
cd diffoscope-crasher
echo "hello" > foo
ln foo bar
mkisofs -R -uid 0 -gid 0 -input-charset utf-8 -v -o ../crasher1.iso .
echo "bye" >> foo
mkisofs -R -uid 0 -gid 0 -input-charset utf-8 -v -o ../crasher2.iso .
cd ..
docker run --rm -it -w $(pwd) -v $(pwd):$(pwd):rw registry.salsa.debian.org/reproducible-builds/diffoscope crasher{1,2}.iso
It seems fairly clear that list_libarchive
ought to account for hardlinks, though it's not obvious to me exactly how the rest of diffoscope would like to consume that information!