Bug#901757: diffoscope: ZIP files: compare comments with zipnote or zipdetails output

Paul Wise pabs at debian.org
Mon Jun 18 02:59:21 BST 2018


Package: diffoscope
Version: 95
Severity: wishlist

It would be nice if comparing ZIP files with diffoscope could compare
the comments embedded in the CDFH and EOCD structures:

https://en.wikipedia.org/wiki/Zip_(file_format)#Central_directory_file_header

This can be done using both zipnote or zipdetails but zipinfo (used by
diffoscope) does not print anything about zip file comments.

I'm not sure which tool to use but maybe use zipnote first and if that
produces no differences then use zipdetails, because the latter also
allows for comparing the compression level of individual files. Or
maybe just use zipdetails if the zipinfo output only differs by the
file size information, since scanning the whole zip may be expensive.

I've illustrated this with the command sequence below.

$ touch foo

$ zip foo.zip foo
  adding: foo (stored 0%)

$ cp foo.zip bar.zip

$ zipnote -w bar.zip <(zipnote foo.zip | sed -e '/@ foo/a hello' -e '$a goodbye')

$ diffoscope foo.zip bar.zip
 |#####################################################################################################################################|  100%                             Time: 0:00:00 
--- foo.zip
+++ bar.zip
├── zipinfo /dev/stdin
│ @@ -1,3 +1,3 @@
│ -Zip file size: 156 bytes, number of entries: 1
│ +Zip file size: 168 bytes, number of entries: 1
│  -rw-r-----  3.0 unx        0 bx stor 18-Jun-18 01:29 foo
│  1 file, 0 bytes uncompressed, 0 bytes compressed:  0.0%

$ diff -u <(zipnote foo.zip) <(zipnote bar.zip)
--- /dev/fd/63	2018-06-18 09:54:26.288808196 +0800
+++ /dev/fd/62	2018-06-18 09:54:26.288808196 +0800
@@ -1,3 +1,5 @@
 @ foo
+hello
 @ (comment above this line)
 @ (zip file comment below this line)
+goodbye

$ diff -u <(zipdetails foo.zip) <(zipdetails bar.zip)
--- /dev/fd/63	2018-06-18 09:54:42.860925054 +0800
+++ /dev/fd/62	2018-06-18 09:54:42.860925054 +0800
@@ -37,7 +37,7 @@
 0055 Uncompressed Length   00000000
 0059 Filename Length       0003
 005B Extra Length          0018
-005D Comment Length        0000
+005D Comment Length        0005
 005F Disk Start            0000
 0061 Int File Attributes   0000
      [Bit 0]               0 'Binary Data'
@@ -55,13 +55,15 @@
 007D   UID                 000003E8
 0081   GID Size            04
 0082   GID                 000003E8
+0086 Comment               'hello'
 
-0086 END CENTRAL HEADER    06054B50
-008A Number of this disk   0000
-008C Central Dir Disk no   0000
-008E Entries in this disk  0001
-0090 Total Entries         0001
-0092 Size of Central Dir   00000049
-0096 Offset to Central Dir 0000003D
-009A Comment Length        0000
+008B END CENTRAL HEADER    06054B50
+008F Number of this disk   0000
+0091 Central Dir Disk no   0000
+0093 Entries in this disk  0001
+0095 Total Entries         0001
+0097 Size of Central Dir   0000004E
+009B Offset to Central Dir 0000003D
+009F Comment Length        0007
+00A1 Comment               'goodbye'
 Done

-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.16.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages diffoscope depends on:
ii  libpython3.6-stdlib    3.6.6~rc1-1
ii  python3                3.6.5-3
ii  python3-distro         1.0.1-2
ii  python3-distutils      3.6.5-4
ii  python3-libarchive-c   2.1-3.1
ii  python3-magic          2:0.4.15-1
ii  python3-pkg-resources  39.1.0-1

Versions of packages diffoscope recommends:
ii  abootimg                         0.6-1+b2
ii  acl                              2.2.52-3+b1
ii  apktool                          2.3.3-1
ii  binutils-multiarch               2.30-21
ii  bzip2                            1.0.6-8.1
ii  caca-utils                       0.99.beta19-2+b3
ii  colord                           1.3.3-2
ii  db-util                          5.3.1
ii  default-jdk [java-sdk]           2:1.10-67
ii  default-jdk-headless             2:1.10-67
pn  device-tree-compiler             <none>
pn  docx2txt                         <none>
ii  e2fsprogs                        1.44.2-1
ii  enjarify                         1:1.0.3-4
ii  fontforge-extras                 0.3-4
pn  fp-utils                         <none>
ii  genisoimage                      9:1.1.11-3+b2
ii  gettext                          0.19.8.1-6+b1
ii  ghc                              8.0.2-11
ii  ghostscript                      9.22~dfsg-2.1
ii  giflib-tools                     5.1.4-3
ii  gnumeric                         1.12.39-1
ii  gnupg                            2.2.8-1
ii  imagemagick                      8:6.9.9.39+dfsg-1
ii  imagemagick-6.q16 [imagemagick]  8:6.9.9.39+dfsg-1
ii  jsbeautifier                     1.6.4-7
pn  libarchive-tools                 <none>
ii  llvm                             1:4.0-40
pn  mono-utils                       <none>
pn  odt2txt                          <none>
pn  oggvideotools                    <none>
ii  openjdk-10-jdk [java-sdk]        10.0.1+10-4
ii  openssh-client                   1:7.7p1-2
ii  pdftk                            2.02-4+b2
ii  pgpdump                          0.31-0.2
ii  poppler-utils                    0.63.0-2
pn  procyon-decompiler               <none>
ii  python3-argcomplete              1.8.1-1
ii  python3-binwalk                  2.1.1-16
ii  python3-debian                   0.1.32
pn  python3-defusedxml               <none>
pn  python3-guestfs                  <none>
ii  python3-jsondiff                 1.1.1-2
ii  python3-progressbar              2.3-4
ii  python3-pyxattr                  0.6.0-2+b1
ii  python3-tlsh                     3.4.4+20151206-1+b3
pn  r-base-core                      <none>
ii  rpm2cpio                         4.14.1+dfsg1-3
ii  sng                              1.1.0-1+b1
ii  sqlite3                          3.24.0-1
ii  squashfs-tools                   1:4.3-6
ii  tcpdump                          4.9.2-3
ii  unzip                            6.0-21
ii  vim-common                       2:8.0.1766-1
pn  xmlutils                         <none>
ii  xxd                              2:8.0.1766-1
ii  xz-utils                         5.2.2-1.3

Versions of packages diffoscope suggests:
ii  libjs-jquery  3.2.1-1

-- no debconf information

-- 
bye,
pabs

https://wiki.debian.org/PaulWise
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://alioth-lists.debian.net/pipermail/reproducible-builds/attachments/20180618/dcf3e232/attachment.sig>


More information about the Reproducible-builds mailing list