Bug#891867: diffoscope: improve .changes diffs
Helmut Grohne
helmut at subdivi.de
Thu Mar 1 20:53:00 UTC 2018
Package: diffoscope
Version: 91
Severity: wishlist
Tags: patch
Hi awesome reproducible team!
I'm working on adding more build profiles and diffoscope + reproducible
builds turn out to be an awesome tool in validating that my profiles
only drop packages and never change package contents. :)
Now I've run into a strange corner case with diffing .changes files. If
the last entry in a Checksums-Sha256 field is removed, new last entry is
removed and added. For example:
├── Files
│ @@ -1,12 +1,8 @@
│
│ a6434caf7853f0e84013e6004b934351 10496 debug optional cracklib-runtime-dbgsym_2.9.2-5.1_amd64.deb
│ 93d547da959c0080bb45cc05d354539f 148972 admin optional cracklib-runtime_2.9.2-5.1_amd64.deb
│ - 608dbc69affb8158f7f203e3c83e5595 11084 libs optional cracklib2_2.9.2-5.1_amd64.buildinfo
│ + 1941a0fd2dbf8b3df8536caab1895993 9042 libs optional cracklib2_2.9.2-5.1_amd64.buildinfo
│ b2010c8e3498d469ae3b5bf5e5469da1 21416 debug optional libcrack2-dbgsym_2.9.2-5.1_amd64.deb
│ f099f5629a8b0cad9e5fba5ded9f88d9 32052 libdevel extra libcrack2-dev_2.9.2-5.1_amd64.deb
│ e3b100bcf99561c965cc5da8ef58e206 120108 debian-installer optional libcrack2-udeb_2.9.2-5.1_amd64.udeb
│ - e04c3f5f14a2c8eb2022ba8eb1d5d915 54788 libs optional libcrack2_2.9.2-5.1_amd64.deb
│ - 85fa278ff743cf93ead1075664df42f2 12880 debug optional python-cracklib-dbgsym_2.9.2-5.1_amd64.deb
│ - 674e3f26f4301f5c253fddb0366a3832 23392 python optional python-cracklib_2.9.2-5.1_amd64.deb
│ - c1bceeb542a7dbed7d2989fd93bba60b 14160 debug optional python3-cracklib-dbgsym_2.9.2-5.1_amd64.deb
│ - b9868203bdda021286129428b5eb3e55 23424 python optional python3-cracklib_2.9.2-5.1_amd64.deb
│ + e04c3f5f14a2c8eb2022ba8eb1d5d915 54788 libs optional libcrack2_2.9.2-5.1_amd64.deb
The DotChangesFile comaprator performs a super call into DebControlFile,
which pulls the Checksums-Sha256 field out of the parsed deb822 file. In
doing so it strips the trailing newline and this what makes for the
difference above. I propose working around the issue with the following
patch:
--- a/diffoscope/comparators/debian.py
+++ b/diffoscope/comparators/debian.py
@@ -142,16 +142,16 @@
# Compare Files as string
if self.deb822.get('Files'):
differences.append(Difference.from_text(
- self.deb822.get_as_string('Files'),
- other.deb822.get_as_string('Files'),
+ self.deb822.get_as_string('Files') + "\n",
+ other.deb822.get_as_string('Files') + "\n",
self.path,
other.path,
source='Files',
))
else:
differences.append(Difference.from_text(
- self.deb822.get_as_string('Checksums-Sha256'),
- other.deb822.get_as_string('Checksums-Sha256'),
+ self.deb822.get_as_string('Checksums-Sha256') + "\n",
+ other.deb822.get_as_string('Checksums-Sha256') + "\n",
self.path,
other.path,
source='Checksums-Sha256',
Many thanks to Mattia Rizzolo for pointing precisely at the relevant
source code.
Helmut
More information about the Reproducible-builds
mailing list