Tests fail under Python 3.11.8 (vs. 3.11.7)
Job [#5273007](https://salsa.debian.org/reproducible-builds/diffoscope/-/jobs/5273007) failed for 18d69030a4dc6a11f58ec2f1f6ade432d9625943: ``` ____________________ ERROR at setup of test_mozzip_metadata ____________________ mozzip1 = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip> mozzip2 = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip> @pytest.fixture def mozzip_differences(mozzip1, mozzip2): > return mozzip1.compare(mozzip2).details mozzip1 = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip> mozzip2 = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip> tests/comparators/test_zip.py:94: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ diffoscope/comparators/zip.py:217: in compare x = super().compare(other, source) __class__ = <class 'diffoscope.comparators.zip.ZipFileBase'> other = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip> self = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip> source = None diffoscope/comparators/utils/file.py:532: in compare difference = self._compare_using_details(other, source) other = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip> self = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip> source = None diffoscope/comparators/utils/file.py:467: in _compare_using_details details.extend( depth = 1 details = [<Difference zipinfo {} -- zipinfo {} []>, None, <Difference filetype from file(1) -- filetype from file(1) []>, None] difference = <Difference /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip -- /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip []> no_recurse = False other = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test2.mozzip> self = <<class 'abc.MozillaZipFile'> /builds/reproducible-builds/diffoscope/tests/data/test1.mozzip> source = None diffoscope/comparators/utils/container.py:130: in comparisons my_members = OrderedDict(self.get_adjusted_members_sizes()) other = <diffoscope.comparators.zip.MozillaZipContainer object at 0x7f714ce3f1d0> self = <diffoscope.comparators.zip.MozillaZipContainer object at 0x7f714cf00ad0> diffoscope/comparators/utils/container.py:126: in get_adjusted_members_sizes size = path_apparent_size(member.path) member = <<class 'diffoscope.comparators.utils.archive.ArchiveMember'> dir/text> name = 'dir/text' self = <diffoscope.comparators.zip.MozillaZipContainer object at 0x7f714cf00ad0> diffoscope/comparators/utils/archive.py:114: in path self._path = self.container.extract( self = <<class 'diffoscope.comparators.utils.archive.ArchiveMember'> dir/text> diffoscope/comparators/zip.py:196: in extract with self.archive.open(member_name) as source, open( dest_dir = '/tmp/diffoscope_5igpcg3m_/tmp08llmn5q_MozillaZipContainer' member_name = 'dir/text' self = <diffoscope.comparators.zip.MozillaZipContainer object at 0x7f714cf00ad0> targetpath = b'/tmp/diffoscope_5igpcg3m_/tmp08llmn5q_MozillaZipContainer/text' _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <zipfile.ZipFile filename='/builds/reproducible-builds/diffoscope/tests/data/test1.mozzip' mode='r'> name = 'dir/text', mode = 'r', pwd = None def open(self, name, mode="r", pwd=None, *, force_zip64=False): """Return file-like object for 'name'. name is a string for the file name within the ZIP file, or a ZipInfo object. mode should be 'r' to read a file already in the ZIP file, or 'w' to write to a file newly added to the archive. pwd is the password to decrypt files (only used for reading). When writing, if the file size is not known in advance but may exceed 2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large files. If the size is known in advance, it is best to pass a ZipInfo instance for name, with zinfo.file_size set. """ if mode not in {"r", "w"}: raise ValueError('open() requires mode "r" or "w"') if pwd and (mode == "w"): raise ValueError("pwd is only supported for reading files") if not self.fp: raise ValueError( "Attempt to use ZIP archive that was already closed") # Make sure we have an info object if isinstance(name, ZipInfo): # 'name' is already an info object zinfo = name elif mode == 'w': zinfo = ZipInfo(name) zinfo.compress_type = self.compression zinfo._compresslevel = self.compresslevel else: # Get info object for name zinfo = self.getinfo(name) if mode == 'w': return self._open_to_write(zinfo, force_zip64=force_zip64) if self._writing: raise ValueError("Can't read from the ZIP file while there " "is an open writing handle on it. " "Close the writing handle before trying to read.") # Open for reading: self._fileRefCnt += 1 zef_file = _SharedFile(self.fp, zinfo.header_offset, self._fpclose, self._lock, lambda: self._writing) try: # Skip the file header: fheader = zef_file.read(sizeFileHeader) if len(fheader) != sizeFileHeader: raise BadZipFile("Truncated file header") fheader = struct.unpack(structFileHeader, fheader) if fheader[_FH_SIGNATURE] != stringFileHeader: raise BadZipFile("Bad magic number for file header") fname = zef_file.read(fheader[_FH_FILENAME_LENGTH]) if fheader[_FH_EXTRA_FIELD_LENGTH]: zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH]) if zinfo.flag_bits & _MASK_COMPRESSED_PATCH: # Zip 2.7: compressed patched data raise NotImplementedError("compressed patched data (flag bit 5)") if zinfo.flag_bits & _MASK_STRONG_ENCRYPTION: # strong encryption raise NotImplementedError("strong encryption (flag bit 6)") if fheader[_FH_GENERAL_PURPOSE_FLAG_BITS] & _MASK_UTF_FILENAME: # UTF-8 filename fname_str = fname.decode("utf-8") else: fname_str = fname.decode(self.metadata_encoding or "cp437") if fname_str != zinfo.orig_filename: raise BadZipFile( 'File name in directory %r and header %r differ.' % (zinfo.orig_filename, fname)) if (zinfo._end_offset is not None and zef_file.tell() + zinfo.compress_size > zinfo._end_offset): > raise BadZipFile(f"Overlapped entries: {zinfo.orig_filename!r} (possible zip bomb)") E zipfile.BadZipFile: Overlapped entries: 'dir/text' (possible zip bomb) fheader = (b'PK\x03\x04', 20, 0, 2, 8, 0, 15393, 1139091176, 269, 446, 8, 0) fname = b'dir/text' fname_str = 'dir/text' force_zip64 = False mode = 'r' name = 'dir/text' pwd = None self = <zipfile.ZipFile filename='/builds/reproducible-builds/diffoscope/tests/data/test1.mozzip' mode='r'> zef_file = <zipfile._SharedFile object at 0x7f714d184090> zinfo = <ZipInfo filename='dir/text' compress_type=deflate filemode='-rw-r--r--' file_size=446 compress_size=269> /usr/lib/python3.11/zipfile.py:1603: BadZipFile ``` [Python 3.11.8 release notes](https://docs.python.org/release/3.11.8/whatsnew/changelog.html#python-3-11-8)
issue