Closed briandealwis closed 5 years ago
Doing a container-diff --type=file --filename=... reports a unified diff but treats the file contents as a single line.
container-diff --type=file --filename=...
Output as per diff -u. In the below, I copied the content reported by container-diff to files /tmp/f1 and /tmp/f2.
diff -u
container-diff
/tmp/f1
/tmp/f2
$ diff -u /tmp/f1 /tmp/f2 --- /tmp/f1 2018-11-02 09:35:03.000000000 -0400 +++ /tmp/f2 2018-11-02 09:35:12.000000000 -0400 @@ -1,9 +1,9 @@ Package: openjdk-8-jre-headless Source: openjdk-8 -Version: 8u171-b11-1~deb9u1 +Version: 8u181-b13-1~deb9u1 Architecture: amd64 Maintainer: OpenJDK Team <openjdk@lists.launchpad.net> -Installed-Size: 97311 +Installed-Size: 97352 Depends: ca-certificates-java, java-common (>= 0.28), libcups2, liblcms2-2 (>= 2.2+git20110628), libjpeg62-turbo (>= 1.3.1), libfontconfig1, libnss3 (>= 2:3.17.1), util-linux (>= 2.26.2-4), libc6 (>= 2.14), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:3.0), libpcsclite1 (>= 1.3.0), libstdc++6 (>= 4.1.1), libx11-6, libxext6, libxi6, libxrender1, libxtst6, zlib1g (>= 1:1.1.4) Suggests: libnss-mdns, fonts-dejavu-extra, fonts-ipafont-gothic, fonts-ipafont-mincho, fonts-wqy-microhei, fonts-wqy-zenhei, fonts-indic Breaks: ca-certificates-java (<< 20160321~), oracle-java8-installer (<< 8u77+8u77arm-1), tzdata-java
The actual behaviour just reports the diff as if the file content was retrieved as a single line.
$ container-diff diff --type=file --filename=/var/lib/dpkg/status.d/openjdk remote://gcr.io/distroless/java@sha256:b430543bea1d8326e767058bdab3a2482ea45f59d7af5c5c61334cd29ede88a1 remote://gcr.io/distroless/java@sha256:bb1c9179c2263733f235291998cb849d52fb730743125420cf4f97a362d6a6dd [...] -----Diff of /var/lib/dpkg/status.d/openjdk----- --- gcr.io/distroless/java@sha256:b430543bea1d8326e767058bdab3a2482ea45f59d7af5c5c61334cd29ede88a1 +++ gcr.io/distroless/java@sha256:bb1c9179c2263733f235291998cb849d52fb730743125420cf4f97a362d6a6dd @@ -1 +1 @@ -Package: openjdk-8-jre-headless Source: openjdk-8 Version: 8u171-b11-1~deb9u1 Architecture: amd64 Maintainer: OpenJDK Team <openjdk@lists.launchpad.net> Installed-Size: 97311 Depends: ca-certificates-java, java-common (>= 0.28), libcups2, liblcms2-2 (>= 2.2+git20110628), libjpeg62-turbo (>= 1.3.1), libfontconfig1, libnss3 (>= 2:3.17.1), util-linux (>= 2.26.2-4), libc6 (>= 2.14), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:3.0), libpcsclite1 (>= 1.3.0), libstdc++6 (>= 4.1.1), libx11-6, libxext6, libxi6, libxrender1, libxtst6, zlib1g (>= 1:1.1.4) Suggests: libnss-mdns, fonts-dejavu-extra, fonts-ipafont-gothic, fonts-ipafont-mincho, fonts-wqy-microhei, fonts-wqy-zenhei, fonts-indic Breaks: ca-certificates-java (<< 20160321~), oracle-java8-installer (<< 8u77+8u77arm-1), tzdata-java Provides: java2-runtime-headless, java5-runtime-headless, java6-runtime-headless, java7-runtime-headless, java8-runtime-headless Section: java Priority: optional Multi-Arch: same Homepage: http://openjdk.java.net/ Description: OpenJDK Java runtime, using Hotspot JIT (headless) Minimal Java runtime - needed for executing non GUI Java programs, using Hotspot JIT. . The packages are built using the IcedTea build support and patches from the IcedTea project. +Package: openjdk-8-jre-headless Source: openjdk-8 Version: 8u181-b13-1~deb9u1 Architecture: amd64 Maintainer: OpenJDK Team <openjdk@lists.launchpad.net> Installed-Size: 97352 Depends: ca-certificates-java, java-common (>= 0.28), libcups2, liblcms2-2 (>= 2.2+git20110628), libjpeg62-turbo (>= 1.3.1), libfontconfig1, libnss3 (>= 2:3.17.1), util-linux (>= 2.26.2-4), libc6 (>= 2.14), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:3.0), libpcsclite1 (>= 1.3.0), libstdc++6 (>= 4.1.1), libx11-6, libxext6, libxi6, libxrender1, libxtst6, zlib1g (>= 1:1.1.4) Suggests: libnss-mdns, fonts-dejavu-extra, fonts-ipafont-gothic, fonts-ipafont-mincho, fonts-wqy-microhei, fonts-wqy-zenhei, fonts-indic Breaks: ca-certificates-java (<< 20160321~), oracle-java8-installer (<< 8u77+8u77arm-1), tzdata-java Provides: java2-runtime-headless, java5-runtime-headless, java6-runtime-headless, java7-runtime-headless, java8-runtime-headless Section: java Priority: optional Multi-Arch: same Homepage: http://openjdk.java.net/ Description: OpenJDK Java runtime, using Hotspot JIT (headless) Minimal Java runtime - needed for executing non GUI Java programs, using Hotspot JIT. . The packages are built using the IcedTea build support and patches from the IcedTea project.
container-diff diff --type=file --filename=/var/lib/dpkg/status.d/openjdk remote://gcr.io/distroless/java@sha256:b430543bea1d8326e767058bdab3a2482ea45f59d7af5c5c61334cd29ede88a1
I think the file contents need to be split with difflib.SplitLines() https://github.com/GoogleContainerTools/container-diff/blob/392203e26a619b83149a9f7deb32498ee550af43/util/diff_utils.go#L169-L171
difflib.SplitLines()
Doing a
container-diff --type=file --filename=...
reports a unified diff but treats the file contents as a single line.Expected behavior
Output as per
diff -u
. In the below, I copied the content reported bycontainer-diff
to files/tmp/f1
and/tmp/f2
.Actual behavior
The actual behaviour just reports the diff as if the file content was retrieved as a single line.
Information
Steps to reproduce the behavior
container-diff diff --type=file --filename=/var/lib/dpkg/status.d/openjdk remote://gcr.io/distroless/java@sha256:b430543bea1d8326e767058bdab3a2482ea45f59d7af5c5c61334cd29ede88a1