Bug#945572: diffoscope: Substitution of the filename with "<elf>" can cause irrelevant differences
Mike Hommey
mh+reportbug at glandium.org
Wed Nov 27 08:30:05 GMT 2019
Package: diffoscope
Version: 132
Severity: normal
Steps to reproduce:
$ cat > foo.c <<EOF
int foo() {
return N;
}
EOF
$ cat > foo.syms <<EOF
libfoo.so {
global: *;
};
EOF
$ mkdir old
$ gcc -o old/libfoo.so -shared foo.c -fPIC -DN=42 -Wl,--version-script,foo.syms
$ gcc -o libfoo.so -shared foo.c -fPIC -DN=2 -Wl,--version-script,foo.syms
$ diffoscope old/libfoo.so libfoo.so
--- old/libfoo.so
+++ libfoo.so
├── readelf --wide --symbols {}
│ @@ -2,16 +2,16 @@
│ Symbol table '.dynsym' contains 7 entries:
│ Num: Value Size Type Bind Vis Ndx Name
│ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
│ 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __cxa_finalize
│ 2: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
│ 3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
│ 4: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
│ - 5: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS libfoo.so
│ - 6: 00000000000010f5 11 FUNC GLOBAL DEFAULT 11 foo@@libfoo.so
│ + 5: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS <elf>
│ + 6: 00000000000010f5 11 FUNC GLOBAL DEFAULT 11 foo@@<elf>
│
│ Symbol table '.symtab' contains 48 entries:
│ Num: Value Size Type Bind Vis Ndx Name
│ 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
│ 1: 0000000000000238 0 SECTION LOCAL DEFAULT 1
│ 2: 0000000000000260 0 SECTION LOCAL DEFAULT 2
│ 3: 0000000000000288 0 SECTION LOCAL DEFAULT 3
│ @@ -53,9 +53,9 @@
│ 39: 0000000000002000 0 NOTYPE LOCAL DEFAULT 13 __GNU_EH_FRAME_HDR
│ 40: 0000000000001100 0 FUNC LOCAL DEFAULT 12 _fini
│ 41: 0000000000004000 0 OBJECT LOCAL DEFAULT 19 _GLOBAL_OFFSET_TABLE_
│ 42: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __cxa_finalize
│ 43: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
│ 44: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
│ 45: 00000000000010f5 11 FUNC GLOBAL DEFAULT 11 foo
│ - 46: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS libfoo.so
│ + 46: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS <elf>
│ 47: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
├── readelf --wide --notes {}
│ @@ -1,4 +1,4 @@
│
│ Displaying notes found in: .note.gnu.build-id
│ Owner Data size Description
│ - GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 53f0f7a35b61ebb857235ac3e519faf82f1dc6e1
│ + GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: ffcb9d36c33ccdc0b1c5819bbfb239e28559c8ee
├── readelf --wide --version-info {}
│ @@ -1,10 +1,10 @@
│
│ Version symbols section '.gnu.version' contains 7 entries:
│ Addr: 0x0000000000000394 Offset: 0x000394 Link: 3 (.dynsym)
│ 000: 0 (*local*) 0 (*local*) 0 (*local*) 0 (*local*)
│ - 004: 0 (*local*) 2 (libfoo.so) 2 (libfoo.so)
│ + 004: 0 (*local*) 2 (<elf>) 2 (<elf>)
│
│ Version definition section '.gnu.version_d' contains 2 entries:
│ Addr: 0x00000000000003a8 Offset: 0x0003a8 Link: 4 (.dynstr)
│ - 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libfoo.so
│ - 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: libfoo.so
│ + 000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: <elf>
│ + 0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: <elf>
├── objdump --line-numbers --disassemble --demangle --reloc --section=.text {}
│ @@ -59,10 +59,10 @@
│ frame_dummy():
│ 10f0: e9 7b ff ff ff jmpq 1070 <register_tm_clones>
│
│ 00000000000010f5 <foo>:
│ foo():
│ 10f5: 55 push %rbp
│ 10f6: 48 89 e5 mov %rsp,%rbp
│ - 10f9: b8 2a 00 00 00 mov $0x2a,%eax
│ + 10f9: b8 02 00 00 00 mov $0x2,%eax
│ 10fe: 5d pop %rbp
│ 10ff: c3 retq
None of these libfoo.so vs. <elf> differences are relevant. They are
entirely due to diffoscope doing the substitution of the filename with
<elf>. Passing full file paths to the command works around the problem:
$ diffoscope old/libfoo.so $PWD/libfoo.so
--- old/libfoo.so
+++ /tmp/libfoo.so
├── readelf --wide --notes {}
│ @@ -1,4 +1,4 @@
│
│ Displaying notes found in: .note.gnu.build-id
│ Owner Data size Description
│ - GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 53f0f7a35b61ebb857235ac3e519faf82f1dc6e1
│ + GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: ffcb9d36c33ccdc0b1c5819bbfb239e28559c8ee
├── objdump --line-numbers --disassemble --demangle --reloc --section=.text {}
│ @@ -59,10 +59,10 @@
│ frame_dummy():
│ 10f0: e9 7b ff ff ff jmpq 1070 <register_tm_clones>
│
│ 00000000000010f5 <foo>:
│ foo():
│ 10f5: 55 push %rbp
│ 10f6: 48 89 e5 mov %rsp,%rbp
│ - 10f9: b8 2a 00 00 00 mov $0x2a,%eax
│ + 10f9: b8 02 00 00 00 mov $0x2,%eax
│ 10fe: 5d pop %rbp
│ 10ff: c3 retq
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.2.0-3-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8), LANGUAGE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages diffoscope depends on:
ii python3 3.7.5-1
ii python3-distro 1.3.0-2
ii python3-distutils 3.7.5-1
ii python3-libarchive-c 2.8-0.4
ii python3-magic 2:0.4.15-2
ii python3-pkg-resources 41.2.0-1
Versions of packages diffoscope recommends:
ii abootimg 0.6-1+b2
ii acl 2.2.53-5
ii apktool 2.4.0-1
ii binutils-multiarch 2.33.1-1
ii bzip2 1.0.8-2
pn caca-utils <none>
ii colord 1.4.3-4
ii db-util 5.3.1+nmu1
pn device-tree-compiler <none>
pn docx2txt <none>
ii e2fsprogs 1.45.4-1
ii enjarify 1:1.0.3-4
ii ffmpeg 7:4.1.4-1+b3
pn fontforge-extras <none>
pn fp-utils <none>
pn genisoimage <none>
ii gettext 0.19.8.1-9
pn ghc <none>
ii ghostscript 9.27~dfsg-3.1
pn giflib-tools <none>
ii gnumeric 1.12.45-1+b1
ii gnupg 2.2.17-3
ii gnupg-utils 2.2.17-3
ii imagemagick 8:6.9.10.23+dfsg-2.1+b2
ii imagemagick-6.q16 [imagemagick] 8:6.9.10.23+dfsg-2.1+b2
pn jsbeautifier <none>
pn libarchive-tools <none>
ii llvm 1:8.0-48.3
ii lz4 [liblz4-tool] 1.9.1-2
pn mono-utils <none>
pn ocaml-nox <none>
pn odt2txt <none>
pn oggvideotools <none>
ii openjdk-8-jdk [java-sdk] 8u232-b09-1
ii openssh-client 1:8.1p1-1
pn pgpdump <none>
ii poppler-utils 0.71.0-6
pn procyon-decompiler <none>
pn python3-argcomplete <none>
ii python3-binwalk 2.2.0+dfsg1-1
ii python3-debian 0.1.36
ii python3-defusedxml 0.6.0-1
pn python3-guestfs <none>
ii python3-jsondiff 1.1.1-4
pn python3-progressbar <none>
pn python3-pypdf2 <none>
ii python3-pyxattr 0.6.1-1
pn python3-tlsh <none>
pn r-base-core <none>
ii rpm2cpio 4.14.2.1+dfsg1-1
pn sng <none>
ii sqlite3 3.30.1-1
ii squashfs-tools 1:4.4-1
ii tcpdump 4.9.3-2
ii unzip 6.0-25
ii vim-common 2:8.1.2136-1
ii wabt 1.0.12-1
ii xmlbeans 3.0.2-1
ii xxd 2:8.1.2136-1
ii xz-utils 5.2.4-1+b1
ii zip 3.0-11+b1
ii zstd 1.4.3+dfsg-1
Versions of packages diffoscope suggests:
ii libjs-jquery 3.3.1~dfsg-3
-- no debconf information
More information about the Reproducible-builds
mailing list