Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package diffoscope for openSUSE:Factory checked in at 2026-11-17 17:20:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/diffoscope (Old) and /work/SRC/openSUSE:Factory/.diffoscope.new.1251 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "diffoscope" Tue Nov 17 17:20:50 2026 rev:56 rq:1398109 version:339 Changes: -------- --- /work/SRC/openSUSE:Factory/diffoscope/diffoscope.changes 2026-10-08 11:58:50.492613243 +0200 +++ /work/SRC/openSUSE:Factory/.diffoscope.new.1251/diffoscope.changes 2026-11-17 17:23:36.066729176 +0100 @@ -1,0 +2,15 @@ +Tue Nov 17 09:40:33 UTC 2026 - Dirk Müller <[email protected]> + +- update to 339: + * Rework including .zip-related differences for .odt files. + * Add some comments to recent OdtFile changes. + * Update copyright years. + * Binutils no longer shows the top-level directory; update + expected test output. + * Mark that the test_nupkg_compressed_files test requires the + tlsh Python module. (Closes: #1151752) + * Support the dumppdf binary being called dumppdf.py on the + host system. + * Update copyright years. + +------------------------------------------------------------------- Old: ---- diffoscope-332.tar.bz2 diffoscope-332.tar.bz2.asc New: ---- diffoscope-339.tar.bz2 diffoscope-339.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ diffoscope.spec ++++++ --- /var/tmp/diff_new_pack.SlXED3/_old 2026-11-17 17:23:36.913765236 +0100 +++ /var/tmp/diff_new_pack.SlXED3/_new 2026-11-17 17:23:36.919765491 +0100 @@ -17,7 +17,7 @@ Name: diffoscope -Version: 332 +Version: 339 Release: 0 Summary: In-depth comparison of files, archives, and directories License: GPL-3.0-or-later ++++++ diffoscope-332.tar.bz2 -> diffoscope-339.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/debian/changelog new/diffoscope-339/debian/changelog --- old/diffoscope-332/debian/changelog 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/debian/changelog 2026-11-13 18:41:13.000000000 +0100 @@ -1,3 +1,70 @@ +diffoscope (339) unstable; urgency=medium + + [ Jay Burstin ] + * Rework including .zip-related differences for .odt files. + + [ Chris Lamb ] + * Add some comments to recent OdtFile changes. + * Update copyright years. + + -- Chris Lamb <[email protected]> Fri, 13 Nov 2026 09:41:11 -0800 + +diffoscope (338) unstable; urgency=medium + + [ Chris Lamb ] + * Binutils no longer shows the top-level directory; update expected test output. + (Closes: #1151752) + + -- Chris Lamb <[email protected]> Mon, 09 Nov 2026 09:40:00 -0800 + +diffoscope (337) unstable; urgency=medium + + [ Chris Lamb ] + * Mark that the test_nupkg_compressed_files test requires the tlsh Python + * module. (Closes: #1151752) + + -- Chris Lamb <[email protected]> Thu, 05 Nov 2026 13:12:45 -0800 + +diffoscope (336) unstable; urgency=medium + + [ Chris Lamb ] + * Drop Recommends: guix from the diffoscope-minimal package. + (Closes: #1114739) + + -- Chris Lamb <[email protected]> Fri, 30 Oct 2026 13:15:14 -0700 + +diffoscope (335) unstable; urgency=medium + + [ Chris Lamb ] + * Support the dumppdf binary being called dumppdf.py on the host system. + * Update copyright years. + * Fix a silly "prepend" typo. + + -- Chris Lamb <[email protected]> Fri, 23 Oct 2026 08:20:40 -0700 + +diffoscope (334) unstable; urgency=medium + + [ Chris Lamb ] + * Fix a crash when using the latest versions of Androguard. Thanks, hc! + (Closes: reproducible-builds/diffoscope#434) + + -- Chris Lamb <[email protected]> Fri, 16 Oct 2026 08:46:38 -0700 + +diffoscope (333) unstable; urgency=medium + + [ Johannes Schauer Marin Rodrigues ] + * Add support for showing differences in POSIX.1-2001 PAX headers within .tar + files. + + [ Chris Lamb ] + * Re-order various parts of the tar comparator to make it easier to + progressively delve into its functionality. + * Reflect that the use of the "case-match" language feature requires at least + Python 3.10+. This can be worked around if it causes problems - let us know. + * Update various copyright years. + + -- Chris Lamb <[email protected]> Fri, 09 Oct 2026 11:00:55 -0700 + diffoscope (332) unstable; urgency=medium [ Chris Lamb ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/debian/rules new/diffoscope-339/debian/rules --- old/diffoscope-332/debian/rules 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/debian/rules 2026-11-13 18:41:13.000000000 +0100 @@ -51,6 +51,7 @@ --recommends-section=comparators grep Recommends debian/diffoscope-minimal.substvars >> debian/diffoscope.substvars # Remove big Recommends from the -minimal package, leaving them only in the full one + sed -i 's/guix,//' debian/diffoscope-minimal.substvars sed -i 's/python3-guestfs,//' debian/diffoscope-minimal.substvars sed -i 's/python3-binwalk,//' debian/diffoscope-minimal.substvars diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/diffoscope/__init__.py new/diffoscope-339/diffoscope/__init__.py --- old/diffoscope-332/diffoscope/__init__.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/diffoscope/__init__.py 2026-11-13 18:41:13.000000000 +0100 @@ -17,4 +17,4 @@ # You should have received a copy of the GNU General Public License # along with diffoscope. If not, see <https://www.gnu.org/licenses/>. -VERSION = "332" +VERSION = "339" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/diffoscope/comparators/apk.py new/diffoscope-339/diffoscope/comparators/apk.py --- old/diffoscope-332/diffoscope/comparators/apk.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/diffoscope/comparators/apk.py 2026-11-13 18:41:13.000000000 +0100 @@ -331,11 +331,17 @@ except Exception: return "" + try: + pairs = instance._v2_blocks.items() + except AttributeError: + # Androguard >= 4.1.4-1 (approx) + pairs = [(b.id, b.data) for b in instance._v2_blocks] + def format_key(x): return "\n".join(textwrap.wrap(binascii.hexlify(x).decode("utf-8"))) output = [] - for k, v in sorted(instance._v2_blocks.items()): + for k, v in sorted(pairs): output.append("Key {}:\n{}\n".format(hex(k), format_key(v))) return "\n".join(output) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/diffoscope/comparators/odt.py new/diffoscope-339/diffoscope/comparators/odt.py --- old/diffoscope-332/diffoscope/comparators/odt.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/diffoscope/comparators/odt.py 2026-11-13 18:41:13.000000000 +0100 @@ -1,7 +1,7 @@ # # diffoscope: in-depth comparison of files, archives, and directories # -# Copyright © 2017-2022, 2025 Chris Lamb <[email protected]> +# Copyright © 2017-2022, 2025-2026 Chris Lamb <[email protected]> # # diffoscope is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,9 +22,10 @@ from diffoscope.tools import tool_required from diffoscope.difference import Difference - +from diffoscope.exc import RequiredToolNotFound from .utils.file import File from .utils.command import Command, our_check_output +from .zip import ZipFile class Odt2txt(Command): @@ -47,13 +48,19 @@ return out.decode("UTF-8").splitlines()[0].split()[0].strip() -class OdtFile(File): +class OdtFile(ZipFile): DESCRIPTION = "OpenOffice .odt files" FILE_TYPE_RE = re.compile(r"^OpenDocument Text\b") def compare_details(self, other, source=None): - return [ - Difference.from_operation( + try: + # First try to compare with odt2txt... + odt_differences = Difference.from_operation( Odt2txt, self.path, other.path, source="odt2txt" ) - ] + except RequiredToolNotFound as exc: + odt_differences = None + self.add_comment(exc.get_comment()) + + # Always print ZipFile differences (odt files are zip files) + return [odt_differences, *super().compare_details(other)] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/diffoscope/comparators/pdf.py new/diffoscope-339/diffoscope/comparators/pdf.py --- old/diffoscope-332/diffoscope/comparators/pdf.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/diffoscope/comparators/pdf.py 2026-11-13 18:41:13.000000000 +0100 @@ -2,7 +2,7 @@ # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2014-2015 Jérémy Bobbio <[email protected]> -# Copyright © 2015-2016, 2018-2024 Chris Lamb <[email protected]> +# Copyright © 2015-2016, 2018-2024, 2026 Chris Lamb <[email protected]> # Copyright © 2023 Mattia Rizzolo <[email protected]> # # diffoscope is free software: you can redistribute it and/or modify @@ -23,6 +23,7 @@ import re from diffoscope.tools import ( + find_executable, python_module_missing, tool_required, get_package_provider, @@ -86,7 +87,7 @@ class Dumppdf(Command): @tool_required("dumppdf") def cmdline(self): - return ["dumppdf", "-at", self.path] + return [find_executable("dumppdf"), "-at", self.path] class PdfFile(File): @@ -105,7 +106,7 @@ Difference.from_operation(Dumppdf, self.path, other.path) ) - # Always preppend metadata differences + # Always prepend metadata differences xs[:0] = self.gen_metadata_differences(other) return xs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/diffoscope/comparators/tar.py new/diffoscope-339/diffoscope/comparators/tar.py --- old/diffoscope-332/diffoscope/comparators/tar.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/diffoscope/comparators/tar.py 2026-11-13 18:41:13.000000000 +0100 @@ -2,7 +2,7 @@ # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2014-2015 Jérémy Bobbio <[email protected]> -# Copyright © 2015-2016, 2018-2020 Chris Lamb <[email protected]> +# Copyright © 2015-2016, 2018-2020, 2026 Chris Lamb <[email protected]> # # diffoscope is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,10 @@ # You should have received a copy of the GNU General Public License # along with diffoscope. If not, see <https://www.gnu.org/licenses/>. +import datetime import re +import struct +import tarfile from diffoscope.difference import Difference @@ -35,12 +38,195 @@ FILE_TYPE_RE = re.compile(r"\btar archive\b") def compare_details(self, other, source=None): + libarchive_result = Difference.from_text_readers( + list_libarchive(self.path), + list_libarchive(other.path), + self.path, + other.path, + source="file list", + ) + if libarchive_result is not None: + return [libarchive_result] + + # The libarchive based reader is not able to spot differences in + # POSIX.1-2001 PAX headers. libarchive itself is capable of reading + # this information (the archive_entry_xattr_* functions) but it + # doesn't seem to expose the relevant functions via libarchive.ffi. + # + # The PAX header stores information like + # * very long filenames and linknames + # * extended attributes + # * POSIX ACLs + # * atime and ctime with sub-second resolution + # * GNU/Hurd translators + # * sparse files + # * files larger than 8 GiB + # * device major and minor numbers with more than 21 bits + # * uid/gid with more than 21 bits + # + # If libarchive is unable to see a difference between the tarballs + # we fall back to the Python tarfile module and try to print more + # information. return [ Difference.from_text_readers( - list_libarchive(self.path), - list_libarchive(other.path), + list_pytarfile(self.path), + list_pytarfile(other.path), self.path, other.path, source="file list", - ) + ), ] + + +def timestamp2str(ts): + try: + return str(datetime.datetime.fromtimestamp(float(ts), datetime.UTC)) + except ValueError: + return f"Unable to parse: {ts}" + + +def read_number(v): + try: + return int(v) + except ValueError: + return f"Unable to parse: {v}" + + +# from https://salsa.debian.org/josch/seedfiles-integration-tests/-/blob/main/test.py +def parse_xattr(acl): + # see uapi/linux/posix_acl.h + POSIX_ACL_XATTR_VERSION = 0x0002 + assert (POSIX_ACL_XATTR_VERSION,) == struct.unpack("<I", acl[:4]) + acl = acl[4:] + assert (1,) == struct.unpack("<H", acl[:2]) # a_refcount + (count,) = struct.unpack("<H", acl[2:4]) + assert b"\xff\xff\xff\xff" == acl[4:8] # filler? + # make sure that the acl minus the header is a multiple of 8 + assert len(acl) % 8 == 0 + assert count >= len(acl) / 8 + count = len(acl) / 8 + result = "" + # see linux/posix_acl.h + while acl: + e_tag, e_perm, e_id = struct.unpack("<hHI", acl[:8]) + match e_tag: + case 0x01: + e_tag = "ACL_USER_OBJ" + case 0x02: + e_tag = "ACL_USER" + case 0x04: + e_tag = "ACL_GROUP_OBJ" + case 0x08: + e_tag = "ACL_GROUP" + case 0x10: + e_tag = "ACL_MASK" + case 0x20: + e_tag = "ACL_OTHER" + case _: + e_tag = f"Unknown e_tag: {e_tag}" + e_perm_str = "" + if e_perm & 0x04: + e_perm_str += "r" + if e_perm & 0x02: + e_perm_str += "w" + if e_perm & 0x01: + e_perm_str += "x" + if e_id + 1 == 2**32: + e_id = "2^32-1" + result += f"\n {e_tag:>13} {e_perm_str:<3} {e_id}" + acl = acl[8:] + return result + + +def list_pytarfile(path): + with tarfile.open(path) as tar: + for member in tar: + if not member.pax_headers: + continue + for k, v in sorted(member.pax_headers.items()): + p = f"{member.name} PAX header {k}" + match k: + case "GNU.sparse.numblocks": + yield f"{p} raw value: {v}\n" + case "GNU.sparse.offset": + yield f"{p}: {read_number(v)}\n" + case "GNU.sparse.numbytes": + yield f"{p}: {read_number(v)}\n" + case "GNU.sparse.size": + yield f"{p}: {read_number(v)}\n" + case "GNU.sparse.map": + yield f"{p} raw value: {v}\n" + case "GNU.sparse.major": + yield f"{p}: {read_number(v)}\n" + case "GNU.sparse.minor": + yield f"{p}: {read_number(v)}\n" + case "GNU.sparse.name": + yield f"{p}: {v}\n" + case "GNU.sparse.realsize": + yield f"{p}: {read_number(v)}\n" + case "LIBARCHIVE.creationtime": + yield f"{p}: {timestamp2str(v)}\n" + case "LIBARCHIVE.symlinktype": + match v: + case "file" | "dir": + yield f"{p}: {v}\n" + case _: + yield f"{p}: Unknown value: {v}" + case "LIBARCHIVE.xattr": + yield f"{p} raw value: {v}\n" + case "RHT.security.selinux": + yield f"{p} raw value: {v}\n" + case "SCHILY.acl.access": + yield f"{p} raw value: {v}\n" + case "SCHILY.acl.default": + yield f"{p} raw value: {v}\n" + case "SCHILY.acl.ace": + yield f"{p} raw value: {v}\n" + case "SCHILY.devmajor": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.devminor": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.fflags": + yield f"{p} raw value: {v}\n" + case "SCHILY.dev": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.ino": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.nlink": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.realsize": + yield f"{p}: {read_number(v)}\n" + case "SCHILY.xattr.gnu.translator": + yield f"{p} raw value: {v}\n" + case "SCHILY.xattr.system.posix_acl_default": + yield f"{p}: {parse_xattr(v.encode(errors='surrogateescape'))}\n" + case "SCHILY.xattr.user": + yield f"{p} raw value: {v}\n" + case "SCHILY.xattr.trusted": + yield f"{p} raw value: {v}\n" + case "SCHILY.xattr.security": + yield f"{p} raw value: {v}\n" + case "SCHILY.xattr.gnu.author": + yield f"{p} raw value: {v}\n" + case "SUN.holesdata": + yield f"{p} raw value: {v}\n" + case "atime" | "ctime" | "mtime": + yield f"{p}: {timestamp2str(v)}\n" + case "gid" | "uid": + yield f"{p}: {read_number(v)}\n" + case "gname" | "uname": + yield f"{p}: {v}\n" + case "hdrcharset": + match v: + case "BINARY": + yield "{p}: BINARY\n" + case "ISO-IR 10646 2000 UTF-8": + yield "{p}: UTF-8\n" + case _: + yield f"{p}: Unknown value: {v}" + case "linkpath": + yield f"{p}: {v}\n" + case "path": + yield f"{p}: {v}\n" + case "size": + yield f"{p}: {read_number(v)}\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/setup.py new/diffoscope-339/setup.py --- old/diffoscope-332/setup.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/setup.py 2026-11-13 18:41:13.000000000 +0100 @@ -6,8 +6,8 @@ from setuptools import setup, find_packages -if sys.version_info < (3, 7): - print("diffoscope requires at least python 3.7", file=sys.stderr) +if sys.version_info < (3, 10): + print("diffoscope requires at least python 3.10", file=sys.stderr) sys.exit(1) @@ -36,7 +36,7 @@ "libarchive-c", ], extras_require=extras_require, - python_requires=">=3.7", + python_requires=">=3.10", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -44,9 +44,6 @@ "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Topic :: Utilities", ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/comparators/test_elf.py new/diffoscope-339/tests/comparators/test_elf.py --- old/diffoscope-332/tests/comparators/test_elf.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/comparators/test_elf.py 2026-11-13 18:41:13.000000000 +0100 @@ -2,7 +2,7 @@ # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2015 Jérémy Bobbio <[email protected]> -# Copyright © 2015-2022, 2024 Chris Lamb <[email protected]> +# Copyright © 2015-2022, 2024, 2026 Chris Lamb <[email protected]> # Copyright © 2021 Jean-Romain Garnier <[email protected]> # # diffoscope is free software: you can redistribute it and/or modify @@ -131,7 +131,7 @@ @skip_unless_tools_exist("readelf", "objdump") -@skip_unless_tool_is_at_least("readelf", readelf_version, "2.38.50") +@skip_unless_tool_is_at_least("readelf", readelf_version, "2.47.50") @skip_if_binutils_does_not_support_x86() def test_lib_differences(lib_differences): assert len(lib_differences) == 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/comparators/test_odt.py new/diffoscope-339/tests/comparators/test_odt.py --- old/diffoscope-332/tests/comparators/test_odt.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/comparators/test_odt.py 2026-11-13 18:41:13.000000000 +0100 @@ -28,6 +28,8 @@ odt1 = load_fixture("test1.odt") odt2 = load_fixture("test2.odt") +odt3 = load_fixture("test3.odt") +odt4 = load_fixture("test4.odt") def odt2txt_version(): @@ -38,23 +40,42 @@ return out.decode("UTF-8").splitlines()[0].split()[1].strip() -def test_identification(odt1): +def test_identification1(odt1): assert isinstance(odt1, OdtFile) -def test_no_differences(odt1): +def test_identification3(odt3): + assert isinstance(odt3, OdtFile) + + +def test_no_differences1(odt1): difference = odt1.compare(odt1) assert difference is None +def test_no_differences3(odt3): + difference = odt3.compare(odt3) + assert difference is None + + @pytest.fixture -def differences(odt1, odt2): +def differences12(odt1, odt2): return odt1.compare(odt2).details [email protected] +def differences34(odt3, odt4): + return odt3.compare(odt4).details + + +@skip_unless_tool_is_at_least("odt2txt", odt2txt_version, "0.5") +def test_diff12(differences12): + assert_diff(differences12[0], "odt_expected_diff_12") + + @skip_unless_tool_is_at_least("odt2txt", odt2txt_version, "0.5") -def test_diff(differences): - assert_diff(differences[0], "odt_expected_diff") +def test_diff34(differences34): + assert_diff(differences34[0], "odt_expected_diff_34") @skip_unless_tool_is_at_least("odt2txt", odt2txt_version, "0.5") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/comparators/test_tar.py new/diffoscope-339/tests/comparators/test_tar.py --- old/diffoscope-332/tests/comparators/test_tar.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/comparators/test_tar.py 2026-11-13 18:41:13.000000000 +0100 @@ -2,7 +2,7 @@ # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2015 Jérémy Bobbio <[email protected]> -# Copyright © 2015-2017, 2020 Chris Lamb <[email protected]> +# Copyright © 2015-2017, 2020, 2026 Chris Lamb <[email protected]> # # diffoscope is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,13 +17,18 @@ # You should have received a copy of the GNU General Public License # along with diffoscope. If not, see <https://www.gnu.org/licenses/>. +import gzip +import os.path import pytest +import struct from diffoscope.config import Config from diffoscope.comparators.tar import TarFile from diffoscope.comparators.missing_file import MissingFile +from diffoscope.comparators.utils.specialize import specialize +from diffoscope.comparators.binary import FilesystemFile -from ..utils.data import load_fixture, get_data +from ..utils.data import load_fixture, get_data, assert_diff from ..utils.nonexisting import assert_non_existing tar1 = load_fixture("test1.tar") @@ -79,3 +84,192 @@ # Comparing with non-existing file makes it easy to make sure all files are unpacked monkeypatch.setattr(Config(), "new_file", True) no_permissions_tar.compare(MissingFile("/nonexistent", no_permissions_tar)) + + +# The result of +# $ tar --format=pax --no-recursion -C /var/log -cf journal.tar ./journal +# once with and once without the --xattrs option +tar_acl_bytes = bytes.fromhex( + "1f8b080085ad436a02ffedd44f4bc3301806f02813a5273f42bf8069fef6ad87" + "9dbc4cf02078f224a1ad30e9ac3419d44faf2fdb4419a2286e179f1f94276d42" + "d2439fcae23a8cb33634ed108b877e393c864efc31c54ae756c9b6535947423b" + "6b4a22e734afd39ab411f928f660195318f855c4ff64551ed27cd14e35558648" + "3932d2581e91b72ee3d97a3d5b92f59a942269cfb5afac336556f9fce6627679" + "752bc790d220e3734ced423ef5713ede85bae3ab6e639c1ef23907e258bcb089" + "385ae509e7849f9f6eeef34d6655f9cda64d7b1f965dfad9ae023e27df4a5fec" + "ee0caeb821ef3ff65e13775ebddbeabf2d9d16b9df67ff87be4f5fad5b7f87cd" + "d98efe910000000000000000000000000000000000bff10adb0252ab00280000" +) + + +tar_noacl_bytes = bytes.fromhex( + "1f8b0800b4ad436a02ffedd43d6a0331108661d53ec55ec0bbfa19699cc2bdcb" + "5c41c45bc4c459d85d83737b0f0e263f458a101b82dfa719a11990407c6abbc7" + "7adcf475db8f53b71b0ee36b7d717fcc9b2272aee67bf55ec50549b1a88a049b" + "0b41bdbae6e86ee030cd75b4abb8fb947c53e7e77dbf0eba8aaa5e34b631d94a" + "739285759fdebb4553b657f1daa687905749625938fc7bed25f4ddf5ceb08447" + "cdf973ee838a7ee4dff6bee63f1509aec9b7ccff380cf34f73d3db34f7fbedf2" + "4a7f24000000000000000000000000f01b278df8083500280000" +) + +# We run tar with --clamp-mtime --mtime=0 but the ctime and atime +# will still be stored in pax headers. Re-create like this: +# $ tar --clamp-mtime --mtime=0 --format=pax --no-recursion -cf bin1.tar ./bin +# $ touch ./bin +# $ tar --clamp-mtime --mtime=0 --format=pax --no-recursion -cf bin2.tar ./bin + +tar_before_bytes = bytes.fromhex( + "1f8b0800000000000003edd3cd0a8240148661d75d8557a067fe6dd1be65b760" + "256450411a74f94d861006b508b3c5fb6c0ecc37301f0c27cb57e5755995dbea" + "dce4ebfa988c40226f6d37a3e1140936514e6b71de191bcf95846092f43a4699" + "a14bd396e758e5176ffd212369d9d6876aa142a10be38cf299b7f107bcf6c52c" + "a69b97d4e898cadccea6ee8eef65f7a5cfc77da35bf1e0ee530527cfb337d87f" + "25da25a91bb7d643bffffb53b3d9bdb9f7290700000000000000000000000026" + "7003acf6139900280000" +) + +tar_after_bytes = bytes.fromhex( + "1f8b0800000000000003edd3cd0a8240148661d75d8557a0f3e39971d3be65b7" + "60266450811678f98d861042b508b3c5fb6c3e983370cee64bd26dd16daa625f" + "356dbaabcfd10c54e0b26cc8609a4af92cd2628c1227360bef5a796fa3b89be3" + "98a95b7b2d9a70ca2f76fd21abe2e25a9faab5f6b9c9ad5897275a7b63c439b7" + "0ad3f2f574e9dbf1bda42f7d3aef8ea1e25efad45ed4738e26fdd7ca4814cbbc" + "673d8cfd3f5edaf2f0e6dfa739000000000000000000000000b0803be9796d3f" + "00280000" +) + + +# Generates a PAX format tarball with a single entry which has the GNU/Hurd +# translator given in the content argument attached to it in a PAX header +def generate_pax( + name, mode, type, linktarget=None, major=None, minor=None, content=None +): + entries = [] + if content is not None: + content = "SCHILY.xattr.gnu.translator=" + content + # In the beginning the decimal length of the field is recorded. + # But the length includes the length of the number itself. + # Luckily we only need to support decimal numbers with two digits. + assert 9 < len(content) + 4 < 100 + dirname, basename = os.path.split(name) + paxname = dirname + "/PaxHeaders/" + basename + content = f"{len(content) +4} {content}\n" + entries.append((paxname, 0, "x", None, None, None, content)) + entries.append((name, mode, type, linktarget, major, minor, None)) + + mtime = int(1612543740) # an arbitrary reproducible date + devtar = b"" + for file in entries: + fname, mode, type, linktarget, major, minor, content = file + assert len(fname) <= 100 + buf = struct.pack( + "@100s8s8s8s12s12s8s1s100s6s2s32s32s8s8s155s12s", + fname.encode(), + f"{mode:07o}".encode(), + b"0" * 7, + b"0" * 7, + f"{len(content) if content is not None else 0:011o}".encode(), + f"{0 if type == 'x' else mtime:011o}".encode(), + b" " * 8, + type.encode(), + linktarget.encode() if linktarget is not None else b"", + b"ustar", + b"00", + b"", + b"", + (f"{major:07o}" if major is not None else "").encode(), + (f"{minor:07o}" if minor is not None else "").encode(), + b"", + b"", + ) + chksum = 256 + sum(struct.unpack_from("148B8x356B", buf)) + buf = buf[:-364] + f"{chksum:06o}\0".encode() + buf[-357:] + devtar += buf + if content is not None: + devtar += struct.pack("@512s", content.encode()) + return struct.pack("@10240s", devtar) + + +def tar_fixture(content, prefix): + @pytest.fixture + def pax_tar(tmp_path, tar1, tar2): + match prefix: + case "test1": + tar = tar1 + case "test2": + tar = tar2 + case _: + raise Exception(f"Invalid prefix: {prefix}") + tar_path = tmp_path / f"{prefix}.tar" + with open(tar_path, "wb") as t_fp: + t_fp.write(content) + with open(tar.path, "rb") as r_fp: + t_fp.write(bytes(r_fp.read())) + return specialize(FilesystemFile(str(tar_path))) + + return pax_tar + + +tar_acl = tar_fixture(gzip.decompress(tar_acl_bytes), "test1") +tar_noacl = tar_fixture(gzip.decompress(tar_noacl_bytes), "test2") + +tar_before = tar_fixture(gzip.decompress(tar_before_bytes), "test1") +tar_after = tar_fixture(gzip.decompress(tar_after_bytes), "test2") + + +# The translator of tar_fd1_translator is wrong -- don't do this at home, kids! +tar_fd0_translator = tar_fixture( + generate_pax( + name="./dev/fd0", mode=0o640, type="0", content="/hurd/storeio\0fd0\0" + ), + "test1", +) +tar_fd1_translator = tar_fixture( + generate_pax( + name="./dev/fd0", mode=0o640, type="0", content="/hurd/storeio\0fd1\0" + ), + "test2", +) + + +def test_identification( + tar_acl, + tar_noacl, + tar_before, + tar_after, + tar_fd0_translator, + tar_fd1_translator, +): + assert isinstance(tar_acl, TarFile) + assert isinstance(tar_noacl, TarFile) + assert isinstance(tar_before, TarFile) + assert isinstance(tar_after, TarFile) + assert isinstance(tar_fd0_translator, TarFile) + assert isinstance(tar_fd1_translator, TarFile) + + [email protected] +def differences_acl(tar_acl, tar_noacl): + return tar_acl.compare(tar_noacl).details + + +def test_listing_acl(differences_acl): + assert_diff(differences_acl[0], "tar_acl_diff") + + [email protected] +def differences_atime(tar_before, tar_after): + return tar_before.compare(tar_after).details + + +def test_listing_atime(differences_atime): + assert_diff(differences_atime[0], "tar_atime_diff") + + [email protected] +def differences_translator(tar_fd0_translator, tar_fd1_translator): + return tar_fd0_translator.compare(tar_fd1_translator).details + + +def test_listing_translator(differences_translator): + assert_diff(differences_translator[0], "tar_translator_diff") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/comparators/test_zip.py new/diffoscope-339/tests/comparators/test_zip.py --- old/diffoscope-332/tests/comparators/test_zip.py 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/comparators/test_zip.py 2026-11-13 18:41:13.000000000 +0100 @@ -29,7 +29,11 @@ ) from ..utils.data import load_fixture, assert_diff -from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least +from ..utils.tools import ( + skip_unless_tools_exist, + skip_unless_tool_is_at_least, + skip_unless_module_exists, +) from ..utils.nonexisting import assert_non_existing zip1 = load_fixture("test1.zip") @@ -159,6 +163,7 @@ @skip_unless_tools_exist("zipinfo") +@skip_unless_module_exists("tlsh") def test_nupkg_compressed_files(nupkg_differences): assert ( nupkg_differences[-1].source1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/elf_lib_metadata_expected_diff new/diffoscope-339/tests/data/elf_lib_metadata_expected_diff --- old/diffoscope-332/tests/data/elf_lib_metadata_expected_diff 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/data/elf_lib_metadata_expected_diff 2026-11-13 18:41:13.000000000 +0100 @@ -1,5 +1,3 @@ -@@ -1,2 +1,2 @@ ------------ 0 0 0 10 2015-06-24 12:14:19.000000 / +@@ -1 +1 @@ --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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/odt_expected_diff new/diffoscope-339/tests/data/odt_expected_diff --- old/diffoscope-332/tests/data/odt_expected_diff 2026-09-28 22:33:20.000000000 +0200 +++ new/diffoscope-339/tests/data/odt_expected_diff 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -@@ -1 +1 @@ --a -+b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/odt_expected_diff_12 new/diffoscope-339/tests/data/odt_expected_diff_12 --- old/diffoscope-332/tests/data/odt_expected_diff_12 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-339/tests/data/odt_expected_diff_12 2026-11-13 18:41:13.000000000 +0100 @@ -0,0 +1,3 @@ +@@ -1 +1 @@ +-a ++b diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/odt_expected_diff_34 new/diffoscope-339/tests/data/odt_expected_diff_34 --- old/diffoscope-332/tests/data/odt_expected_diff_34 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-339/tests/data/odt_expected_diff_34 2026-11-13 18:41:13.000000000 +0100 @@ -0,0 +1,35 @@ +@@ -1,17 +1,17 @@ +-Zip file size: 8625 bytes, number of entries: 15 +--rw---- 2.0 fat 39 b- stor 26-Nov-08 16:03 mimetype +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/toolpanel/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/floater/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/statusbar/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/toolbar/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/progressbar/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/popupmenu/ +--rw---- 2.0 fat 0 b- stor 26-Nov-08 16:03 Configurations2/menubar/ +--rw---- 2.0 fat 12835 bl defN 26-Nov-08 16:03 styles.xml +--rw---- 2.0 fat 899 bl defN 26-Nov-08 16:03 manifest.rdf +--rw---- 2.0 fat 3431 bl defN 26-Nov-08 16:03 content.xml +--rw---- 2.0 fat 757 bl defN 26-Nov-08 16:03 meta.xml +--rw---- 2.0 fat 12765 bl defN 26-Nov-08 16:03 settings.xml +--rw---- 2.0 fat 854 b- stor 26-Nov-08 16:03 Thumbnails/thumbnail.png +--rw---- 2.0 fat 1061 bl defN 26-Nov-08 16:03 META-INF/manifest.xml +-15 files, 32641 bytes uncompressed, 6799 bytes compressed: 79.2% ++Zip file size: 8627 bytes, number of entries: 15 ++-rw---- 2.0 fat 39 b- stor 26-Nov-08 16:04 mimetype ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/toolpanel/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/floater/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/statusbar/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/toolbar/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/progressbar/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/popupmenu/ ++-rw---- 2.0 fat 0 b- stor 26-Nov-08 16:04 Configurations2/menubar/ ++-rw---- 2.0 fat 12835 bl defN 26-Nov-08 16:04 styles.xml ++-rw---- 2.0 fat 899 bl defN 26-Nov-08 16:04 manifest.rdf ++-rw---- 2.0 fat 3431 bl defN 26-Nov-08 16:04 content.xml ++-rw---- 2.0 fat 757 bl defN 26-Nov-08 16:04 meta.xml ++-rw---- 2.0 fat 12767 bl defN 26-Nov-08 16:04 settings.xml ++-rw---- 2.0 fat 854 b- stor 26-Nov-08 16:04 Thumbnails/thumbnail.png ++-rw---- 2.0 fat 1061 bl defN 26-Nov-08 16:04 META-INF/manifest.xml ++15 files, 32643 bytes uncompressed, 6801 bytes compressed: 79.2% diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/tar_acl_diff new/diffoscope-339/tests/data/tar_acl_diff --- old/diffoscope-332/tests/data/tar_acl_diff 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-339/tests/data/tar_acl_diff 2026-11-13 18:41:13.000000000 +0100 @@ -0,0 +1,9 @@ +@@ -1,8 +1,2 @@ +-./journal PAX header SCHILY.xattr.system.posix_acl_default: +- ACL_USER_OBJ rwx 2^32-1 +- ACL_GROUP_OBJ rx 2^32-1 +- ACL_GROUP rx 4 +- ACL_MASK rx 2^32-1 +- ACL_OTHER rx 2^32-1 + ./journal PAX header atime: 2026-06-29 22:01:12.232778+00:00 + ./journal PAX header ctime: 2023-01-12 09:50:07.391583+00:00 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/diffoscope-332/tests/data/tar_atime_diff new/diffoscope-339/tests/data/tar_atime_diff --- old/diffoscope-332/tests/data/tar_atime_diff 1970-01-01 01:00:00.000000000 +0100 +++ new/diffoscope-339/tests/data/tar_atime_diff 2026-11-13 18:41:13.000000000 +0100 @@ -0,0 +1,5 @@ +@@ -1,2 +1,2 @@ +-./bin PAX header atime: 2026-06-30 16:01:56.640106+00:00 +-./bin PAX header ctime: 2026-06-30 16:01:56.632106+00:00 ++./bin PAX header atime: 2026-06-30 16:02:48.117226+00:00 ++./bin PAX header ctime: 2026-06-30 16:02:48.117226+00:00 Binary files old/diffoscope-332/tests/data/tar_translator_diff and new/diffoscope-339/tests/data/tar_translator_diff differ Binary files old/diffoscope-332/tests/data/test3.odt and new/diffoscope-339/tests/data/test3.odt differ Binary files old/diffoscope-332/tests/data/test4.odt and new/diffoscope-339/tests/data/test4.odt differ
