[Reproducible-builds] Bug#808199: diffoscope: Weird line numbering in diff output
Mike Hommey
mh at glandium.org
Thu Dec 17 06:03:21 UTC 2015
Attached here is two files that can be compared directly, exposing the
same problem. That's essentially the output of tar --full-time -tvf on
both tarballs from the original bug report.
The following patch fixes the numbering issue:
diff --git a/diffoscope/presenters/html.py b/diffoscope/presenters/html.py
index f425889..315a639 100644
--- a/diffoscope/presenters/html.py
+++ b/diffoscope/presenters/html.py
@@ -346,7 +346,7 @@ def output_line(print_func, s1, s2):
print_func(u'<tr class="diff%s">' % type_name)
try:
- if s1 is not None:
+ if s1:
print_func(u'<td class="diffline">%d </td>' % line1)
print_func(u'<td class="diffpresent">')
print_func(convert(s1, ponct=1, tag='del'))
@@ -355,7 +355,7 @@ def output_line(print_func, s1, s2):
s1 = ""
print_func(u'<td colspan="2"> </td>')
- if s2 is not None:
+ if s2:
print_func(u'<td class="diffline">%d </td>' % line2)
print_func(u'<td class="diffpresent">')
print_func(convert(s2, ponct=1, tag='ins'))
@@ -369,12 +369,12 @@ def output_line(print_func, s1, s2):
m = orig1 and re.match(r"^\[ (\d+) lines removed \]$", orig1)
if m:
line1 += int(m.group(1))
- elif orig1 is not None:
+ elif orig1:
line1 += 1
m = orig2 and re.match(r"^\[ (\d+) lines removed \]$", orig2)
if m:
line2 += int(m.group(1))
- elif orig2 is not None:
+ elif orig2:
line2 += 1
However, there's another issue, that the diff is actually incomplete:
the right hand side stops 3 lines too early.
(The patch is not actually changing anything here, I just figured
once the numbers looked normal, but didn't match)
Mike
-------------- next part --------------
drwxr-xr-x 0/0 0 2015-12-16 18:43:24 firefox/
-rw-r--r-- 0/0 899 2015-12-16 18:43:17 firefox/libnssdbm3.chk
-rw-r--r-- 0/0 899 2015-12-16 18:43:17 firefox/libfreebl3.chk
-rwxr-xr-x 0/0 141782 2015-12-16 18:43:17 firefox/libnssdbm3.so
-rwxr-xr-x 0/0 98107 2015-12-16 18:43:17 firefox/crashreporter
-rwxr-xr-x 0/0 1152003 2015-12-16 18:43:17 firefox/libnss3.so
-rwxr-xr-x 0/0 170163 2015-12-16 18:43:17 firefox/firefox-bin
-rw-r--r-- 0/0 1936 2015-12-16 18:43:24 firefox/precomplete
-rw-r--r-- 0/0 4003 2015-09-11 09:29:56 firefox/crashreporter.ini
-rwxr-xr-x 0/0 288136 2015-12-16 18:43:13 firefox/libnspr4.so
-rw-r--r-- 0/0 691 2015-12-16 18:17:17 firefox/application.ini
-rwxr-xr-x 0/0 178734 2015-12-16 18:43:17 firefox/libnssutil3.so
-rwxr-xr-x 0/0 415676 2015-12-16 18:43:17 firefox/plugin-container
-rw-r--r-- 0/0 140 2015-12-16 18:37:34 firefox/dependentlibs.list
-rw-r--r-- 0/0 132 2015-12-16 18:38:17 firefox/update-settings.ini
-rw-r--r-- 0/0 825 2015-09-11 09:29:59 firefox/Throbber-small.gif
-rwxr-xr-x 0/0 8915 2015-09-11 09:29:34 firefox/run-mozilla.sh
-rwxr-xr-x 0/0 17250 2015-12-16 18:43:13 firefox/libplds4.so
drwxr-xr-x 0/0 0 2015-12-16 18:43:13 firefox/dictionaries/
-rw-r--r-- 0/0 3074 2015-09-11 09:30:02 firefox/dictionaries/en-US.aff
-rw-r--r-- 0/0 599769 2015-12-04 07:02:07 firefox/dictionaries/en-US.dic
-rwxr-xr-x 0/0 200987 2015-12-16 18:43:17 firefox/webapprt-stub
-rwxr-xr-x 0/0 99927433 2015-12-16 18:43:16 firefox/libxul.so
-rwxr-xr-x 0/0 85802 2015-12-16 18:43:17 firefox/liblgpllibs.so
-rwxr-xr-x 0/0 604259 2015-12-16 18:43:17 firefox/libnssckbi.so
-rwxr-xr-x 0/0 22824 2015-12-16 18:43:13 firefox/libplc4.so
-rw-r--r-- 0/0 9814288 2015-12-16 18:43:09 firefox/omni.ja
-rwxr-xr-x 0/0 693226 2015-12-16 18:43:17 firefox/libmozsqlite3.so
-rw-r--r-- 0/0 707 2015-12-16 18:43:17 firefox/removed-files
-rwxr-xr-x 0/0 141334 2015-12-16 18:43:17 firefox/updater
-rw-r--r-- 0/0 899 2015-12-16 18:43:17 firefox/libsoftokn3.chk
drwxr-xr-x 0/0 0 2015-12-16 18:43:00 firefox/defaults/
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/defaults/pref/
-rw-r--r-- 0/0 245 2015-12-16 18:38:37 firefox/defaults/pref/channel-prefs.js
-rwxr-xr-x 0/0 504460 2015-12-16 18:43:17 firefox/libfreebl3.so
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/webapprt/
-rw-r--r-- 0/0 75463 2015-12-16 18:43:17 firefox/webapprt/omni.ja
-rw-r--r-- 0/0 495 2015-12-16 18:38:30 firefox/webapprt/webapprt.ini
-rwxr-xr-x 0/0 13582 2015-12-16 18:43:17 firefox/libmozgtk.so
-rw-r--r-- 0/0 681 2015-12-16 18:38:34 firefox/updater.ini
-rwxr-xr-x 0/0 170155 2015-12-16 18:43:17 firefox/firefox
-rw-r--r-- 0/0 145 2015-12-16 18:38:27 firefox/platform.ini
-rwxr-xr-x 0/0 263135 2015-12-16 18:43:17 firefox/libsoftokn3.so
-rwxr-xr-x 0/0 257055 2015-12-16 18:43:17 firefox/libssl3.so
drwxr-xr-x 0/0 0 2015-12-16 18:43:00 firefox/gmp-clearkey/
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/gmp-clearkey/0.1/
-rwxr-xr-x 0/0 92654 2015-12-16 18:43:17 firefox/gmp-clearkey/0.1/libclearkey.so
-rw-r--r-- 0/0 116 2015-12-16 18:38:30 firefox/gmp-clearkey/0.1/clearkey.info
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/icons/
-rw-r--r-- 0/0 4030 2015-09-11 09:29:58 firefox/icons/updater.png
-rwxr-xr-x 0/0 179788 2015-12-16 18:43:17 firefox/libsmime3.so
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/browser/
-rw-r--r-- 0/0 188829 2015-12-04 07:02:06 firefox/browser/blocklist.xml
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/browser/components/
-rwxr-xr-x 0/0 68737 2015-12-16 18:43:17 firefox/browser/components/libbrowsercomps.so
-rw-r--r-- 0/0 36 2015-12-16 18:43:01 firefox/browser/components/components.manifest
-rw-r--r-- 0/0 40 2015-12-16 18:43:01 firefox/browser/chrome.manifest
-rw-r--r-- 0/0 783 2015-09-11 09:29:31 firefox/browser/crashreporter-override.ini
drwxr-xr-x 0/0 0 2015-12-16 18:43:00 firefox/browser/chrome/
drwxr-xr-x 0/0 0 2015-12-16 18:43:00 firefox/browser/chrome/icons/
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/browser/chrome/icons/default/
-rw-r--r-- 0/0 939 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default16.png
-rw-r--r-- 0/0 2590 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default32.png
-rw-r--r-- 0/0 3937 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default48.png
-rw-r--r-- 0/0 13414988 2015-12-16 18:43:13 firefox/browser/omni.ja
drwxr-xr-x 0/0 0 2015-12-16 18:43:01 firefox/browser/features/
-rw-r--r-- 0/0 1239506 2015-12-16 18:43:01 firefox/browser/features/loop at mozilla.org.xpi
drwxr-xr-x 0/0 0 2015-12-16 18:43:00 firefox/browser/extensions/
-rw-r--r-- 0/0 3376 2015-12-16 18:43:00 firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/browser/icons/
-rw-r--r-- 0/0 17364 2015-09-11 09:29:23 firefox/browser/icons/mozicon128.png
drwxr-xr-x 0/0 0 2015-12-16 18:43:17 firefox/gtk2/
-rwxr-xr-x 0/0 23585 2015-12-16 18:43:17 firefox/gtk2/libmozgtk.so
-------------- next part --------------
drwxr-xr-x 0/0 0 2015-12-17 09:57:03 firefox/
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/browser/
-rw-r--r-- 0/0 13414988 2015-12-17 09:56:52 firefox/browser/omni.ja
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/browser/extensions/
-rw-r--r-- 0/0 3376 2015-12-17 09:56:40 firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
-rw-r--r-- 0/0 783 2015-09-11 09:29:31 firefox/browser/crashreporter-override.ini
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/browser/features/
-rw-r--r-- 0/0 1239506 2015-12-17 09:56:40 firefox/browser/features/loop at mozilla.org.xpi
-rw-r--r-- 0/0 188829 2015-12-04 07:02:06 firefox/browser/blocklist.xml
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/browser/components/
-rw-r--r-- 0/0 36 2015-12-17 09:56:40 firefox/browser/components/components.manifest
-rwxr-xr-x 0/0 68737 2015-12-17 09:56:56 firefox/browser/components/libbrowsercomps.so
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/browser/icons/
-rw-r--r-- 0/0 17364 2015-09-11 09:29:23 firefox/browser/icons/mozicon128.png
-rw-r--r-- 0/0 40 2015-12-17 09:56:40 firefox/browser/chrome.manifest
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/browser/chrome/
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/browser/chrome/icons/
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/browser/chrome/icons/default/
-rw-r--r-- 0/0 939 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default16.png
-rw-r--r-- 0/0 3937 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default48.png
-rw-r--r-- 0/0 2590 2015-09-11 09:29:23 firefox/browser/chrome/icons/default/default32.png
-rw-r--r-- 0/0 691 2015-12-17 09:29:47 firefox/application.ini
-rwxr-xr-x 0/0 263135 2015-12-17 09:56:56 firefox/libsoftokn3.so
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/gmp-clearkey/
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/gmp-clearkey/0.1/
-rwxr-xr-x 0/0 92654 2015-12-17 09:56:56 firefox/gmp-clearkey/0.1/libclearkey.so
-rw-r--r-- 0/0 116 2015-12-17 09:51:30 firefox/gmp-clearkey/0.1/clearkey.info
-rw-r--r-- 0/0 9814288 2015-12-17 09:56:48 firefox/omni.ja
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/webapprt/
-rw-r--r-- 0/0 75463 2015-12-17 09:56:56 firefox/webapprt/omni.ja
-rw-r--r-- 0/0 495 2015-12-17 09:51:31 firefox/webapprt/webapprt.ini
-rw-r--r-- 0/0 140 2015-12-17 09:50:37 firefox/dependentlibs.list
-rw-r--r-- 0/0 145 2015-12-17 09:51:26 firefox/platform.ini
-rw-r--r-- 0/0 132 2015-12-17 09:51:16 firefox/update-settings.ini
-rwxr-xr-x 0/0 8915 2015-09-11 09:29:34 firefox/run-mozilla.sh
-rw-r--r-- 0/0 707 2015-12-17 09:56:56 firefox/removed-files
-rw-r--r-- 0/0 825 2015-09-11 09:29:59 firefox/Throbber-small.gif
-rwxr-xr-x 0/0 200987 2015-12-17 09:56:56 firefox/webapprt-stub
-rwxr-xr-x 0/0 170155 2015-12-17 09:56:56 firefox/firefox
-rw-r--r-- 0/0 4003 2015-09-11 09:29:56 firefox/crashreporter.ini
-rw-r--r-- 0/0 681 2015-12-17 09:51:34 firefox/updater.ini
drwxr-xr-x 0/0 0 2015-12-17 09:56:40 firefox/defaults/
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/defaults/pref/
-rw-r--r-- 0/0 245 2015-12-17 09:51:37 firefox/defaults/pref/channel-prefs.js
-rwxr-xr-x 0/0 98107 2015-12-17 09:56:56 firefox/crashreporter
-rwxr-xr-x 0/0 170163 2015-12-17 09:56:56 firefox/firefox-bin
-rwxr-xr-x 0/0 504460 2015-12-17 09:56:56 firefox/libfreebl3.so
-rwxr-xr-x 0/0 141334 2015-12-17 09:56:56 firefox/updater
-rwxr-xr-x 0/0 1152003 2015-12-17 09:56:56 firefox/libnss3.so
-rw-r--r-- 0/0 1936 2015-12-17 09:57:03 firefox/precomplete
-rwxr-xr-x 0/0 17250 2015-12-17 09:56:52 firefox/libplds4.so
drwxr-xr-x 0/0 0 2015-12-17 09:56:52 firefox/dictionaries/
-rw-r--r-- 0/0 599769 2015-12-04 07:02:07 firefox/dictionaries/en-US.dic
-rw-r--r-- 0/0 3074 2015-09-11 09:30:02 firefox/dictionaries/en-US.aff
-rwxr-xr-x 0/0 415676 2015-12-17 09:56:56 firefox/plugin-container
-rwxr-xr-x 0/0 99927433 2015-12-17 09:56:55 firefox/libxul.so
-rw-r--r-- 0/0 899 2015-12-17 09:56:56 firefox/libsoftokn3.chk
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/gtk2/
-rwxr-xr-x 0/0 23585 2015-12-17 09:56:56 firefox/gtk2/libmozgtk.so
-rwxr-xr-x 0/0 141782 2015-12-17 09:56:56 firefox/libnssdbm3.so
-rwxr-xr-x 0/0 179788 2015-12-17 09:56:56 firefox/libsmime3.so
-rwxr-xr-x 0/0 178734 2015-12-17 09:56:56 firefox/libnssutil3.so
-rw-r--r-- 0/0 899 2015-12-17 09:56:56 firefox/libnssdbm3.chk
-rwxr-xr-x 0/0 22824 2015-12-17 09:56:52 firefox/libplc4.so
drwxr-xr-x 0/0 0 2015-12-17 09:56:56 firefox/icons/
-rw-r--r-- 0/0 4030 2015-09-11 09:29:58 firefox/icons/updater.png
-rwxr-xr-x 0/0 288136 2015-12-17 09:56:52 firefox/libnspr4.so
-rwxr-xr-x 0/0 85802 2015-12-17 09:56:56 firefox/liblgpllibs.so
-rw-r--r-- 0/0 899 2015-12-17 09:56:56 firefox/libfreebl3.chk
-rwxr-xr-x 0/0 257055 2015-12-17 09:56:56 firefox/libssl3.so
-rwxr-xr-x 0/0 693226 2015-12-17 09:56:56 firefox/libmozsqlite3.so
-rwxr-xr-x 0/0 13582 2015-12-17 09:56:56 firefox/libmozgtk.so
-rwxr-xr-x 0/0 604259 2015-12-17 09:56:56 firefox/libnssckbi.so
More information about the Reproducible-builds
mailing list