Discussion:
Bug#1085257: diffoscope: Compare ar(1) archives
Add Reply
Alejandro Colomar
2024-10-17 10:40:02 UTC
Reply
Permalink
Package: diffoscope
Version: 280
Severity: wishlist
Tags: upstream
X-Debbugs-Cc: ***@kernel.org

Dear Maintainer,

It would be nice to be able to compare ar(1) archives.

Have a lovely day!
Alex


-- System Information:
Debian Release: trixie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.11.2-amd64 (SMP w/24 CPU threads; PREEMPT)
Locale: LANG=C.utf8, LC_CTYPE=C.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages diffoscope depends on:
ii diffoscope-minimal 280

Versions of packages diffoscope recommends:
ii 7zip 24.08+dfsg-1
ii aapt 1:14~beta1-2+b3
ii abootimg 0.6-1.1
ii acl 2.3.2-2
ii androguard 3.4.0~a1-15
ii apksigcopier 1.1.1-1
ii apksigner 31.0.2-2
ii apktool 2.7.0+dfsg-7
ii binutils-multiarch 2.43.1-5
ii bzip2 1.0.8-6
ii caca-utils 0.99.beta20-5
ii colord 1.4.7-1+b1
ii coreboot-utils 4.15~dfsg-4
ii db-util 5.3.3
ii default-jdk-headless 2:1.21-76
ii device-tree-compiler 1.7.0-2+b1
ii dexdump 14.0.0+r15-3
ii docx2txt 1.4-5
ii e2fsprogs 1.47.1-1
ii enjarify 1:1.0.3-5
ii ffmpeg 7:7.0.2-3
ii fontforge-extras 1:20230101~dfsg-4
ii fonttools 4.46.0-1
ii fp-utils 3.2.2+dfsg-34
ii fp-utils-3.2.2 [fp-utils] 3.2.2+dfsg-34
ii genisoimage 9:1.1.11-3.5
ii gettext 0.22.5-2
ii ghc 9.6.6-2
ii ghostscript 10.04.0~dfsg-1
ii giflib-tools 5.2.2-1
ii gnumeric 1.12.57-1+b1
ii gnupg-utils 2.2.44-1
ii gpg 2.2.44-1
ii hdf5-tools 1.10.10+repack-4
ii html2text 2.2.3-2
ii imagemagick 8:6.9.13.12+dfsg1-1
ii imagemagick-6.q16 [imagemagick] 8:6.9.13.12+dfsg1-1
ii jsbeautifier 1.15.1-1
ii libarchive-tools 3.7.4-1
ii libxmlb-utils 0.3.19-1
ii llvm 1:19.0-60
ii lz4 1.9.4-3
ii lzip 1.24.1-2
ii mono-utils 6.12.0.199+dfsg-1
ii ocaml-nox 5.2.0-3
ii odt2txt 0.5-7
ii oggvideotools 0.9.1-7
ii openssh-client 1:9.9p1-1
ii openssl 3.3.2-1
ii perl 5.38.2-5
ii pgpdump 0.36-1
ii poppler-utils 24.08.0-2
ii procyon-decompiler 0.6.0-3
ii python3-argcomplete 3.4.0-2
ii python3-binwalk 2.4.2+dfsg1-1
ii python3-debian 0.1.49
ii python3-defusedxml 0.7.1-2
ii python3-guestfs 1:1.52.2-4
ii python3-jsondiff 2.1.2-1
ii python3-pdfminer 20221105+dfsg-1
ii python3-progressbar 2.5-4
ii python3-pypdf 4.3.1-1
ii python3-pyxattr 0.8.1-1+b3
ii python3-rpm 4.20.0+dfsg-1
ii python3-tlsh 3.4.4+20151206-1.4+b6
ii r-base-core 4.4.1-3
ii radare2 5.9.4+dfsg-1
ii rpm2cpio 4.20.0+dfsg-1
ii sng 1.1.0-4+b1
ii sqlite3 3.46.1-1
ii squashfs-tools 1:4.6.1-1
ii tcpdump 4.99.5-1
ii u-boot-tools 2024.01+dfsg-5+b2
ii unzip 6.0-28
ii wabt 1.0.34+dsfg2+~cs1.0.32-1+b1
ii xmlbeans 4.0.0-2
ii xxd 2:9.1.0777-1
ii xz-utils 5.6.2-2
ii zip 3.0-14
ii zstd 1.5.6+dfsg-1

Versions of packages diffoscope suggests:
ii libjs-jquery 3.6.1+dfsg+~3.5.14-1

-- no debconf information
Chris Lamb
2024-10-17 17:40:01 UTC
Reply
Permalink
Hello Alejandro,
Post by Alejandro Colomar
It would be nice to be able to compare ar(1) archives.
It should already do!

$ diffoscope tests/data/test1.a tests/data/test2.a

--- tests/data/test1.a
+++ tests/data/test2.a
├── file list
│ @@ -1,2 +1,2 @@
│ ----------- 0 0 0 10 2015-06-24 12:14:19.000000 /
│ --rw-r--r-- 0 1000 1000 1216 2015-06-24 12:13:47.000000 test.o
│ +---------- 0 0 0 10 2015-06-24 12:14:29.000000 /
│ +-rw-r--r-- 0 1000 1000 1216 2015-06-24 12:14:27.000000 test.o
├── test.o
│ ├── objdump --line-numbers --disassemble --demangle --reloc --no-show-raw-insn --section=.text {}
│ │ @@ -3,10 +3,10 @@
│ │
│ │ Disassembly of section .text:
│ │
│ │ 0000000000000000 <f>:
│ │ f():
│ │ push %rbp
│ │ mov %rsp,%rbp
│ │ - mov $0x2a,%eax
│ │ + mov $0xffffffff,%eax
│ │ pop %rbp
│ │ ret

Do you not get the same thing? You may need to install the binutils
package.


Regards,
--
,''`.
: :' : Chris Lamb
`. `'` ***@debian.org 🍥 chris-lamb.co.uk
`-
Alejandro Colomar
2024-10-17 21:30:02 UTC
Reply
Permalink
Post by Chris Lamb
Hello Alejandro,
Hi Chris!
Post by Chris Lamb
Post by Alejandro Colomar
It would be nice to be able to compare ar(1) archives.
It should already do!
$ diffoscope tests/data/test1.a tests/data/test2.a
--- tests/data/test1.a
+++ tests/data/test2.a
├── file list
│ ----------- 0 0 0 10 2015-06-24 12:14:19.000000 /
│ --rw-r--r-- 0 1000 1000 1216 2015-06-24 12:13:47.000000 test.o
│ +---------- 0 0 0 10 2015-06-24 12:14:29.000000 /
│ +-rw-r--r-- 0 1000 1000 1216 2015-06-24 12:14:27.000000 test.o
├── test.o
│ ├── objdump --line-numbers --disassemble --demangle --reloc --no-show-raw-insn --section=.text {}
│ │
│ │
│ │ push %rbp
│ │ mov %rsp,%rbp
│ │ - mov $0x2a,%eax
│ │ + mov $0xffffffff,%eax
│ │ pop %rbp
│ │ ret
Do you not get the same thing? You may need to install the binutils
package.
Humm. I might be in front of a bug? I was trying to see what was the
difference between an archive before and after running ranlib(1) on it.
Maybe that was the issue?

See below.

Have a lovely day!
Alex


***@debian:~/src/alx/liba2i/contrib$ dpkg -l binutils | tail -n1
ii binutils 2.43.1-5 amd64 GNU assembler, linker and binary utilities
***@debian:~/src/alx/liba2i/contrib$ diffoscope liba2i.a liba2i_ranlibbed.a
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 767, in main
sys.exit(run_diffoscope(parsed_args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/main.py", line 718, in run_diffoscope
difference = compare_root_paths(path1, path2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/compare.py", line 69, in compare_root_paths
difference = compare_files(file1, file2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/compare.py", line 149, in compare_files
return file1.compare(file2, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/file.py", line 536, in compare
difference = self._compare_using_details(other, source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/file.py", line 437, in _compare_using_details
details.extend(self.compare_details(other, source))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/ar.py", line 71, in compare_details
Difference.from_text_readers(
File "/usr/lib/python3/dist-packages/diffoscope/difference.py", line 258, in from_text_readers
return Difference.from_feeder(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/difference.py", line 214, in from_feeder
unified_diff = diff(feeder1, feeder2)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/diff.py", line 334, in diff
with FIFOFeeder(feeder1, fifo1_path) as fifo1, FIFOFeeder(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/diff.py", line 225, in __exit__
self.join()
File "/usr/lib/python3/dist-packages/diffoscope/diff.py", line 258, in join
raise self._exception
File "/usr/lib/python3/dist-packages/diffoscope/diff.py", line 249, in run
end_nl = self.feeder(fifo)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/feeders.py", line 79, in feeder
for buf in in_file:
^^^^^^^
File "/usr/lib/python3/dist-packages/diffoscope/comparators/utils/libarchive.py", line 134, in list_libarchive
for entry in archive:
^^^^^^^
File "/usr/lib/python3/dist-packages/libarchive/read.py", line 27, in __iter__
r = read_next_header2(archive_p, entry._entry_p)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/libarchive/ffi.py", line 98, in check_int
raise archive_error(args[0], retcode)
libarchive.exception.ArchiveError: Invalid string table (errno=22, retcode=-30, archive_p=139655089495440)
--
<https://www.alejandro-colomar.es/>
Loading...