Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package diffoscope for openSUSE:Factory 
checked in at 2022-04-08 22:46:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/diffoscope (Old)
 and      /work/SRC/openSUSE:Factory/.diffoscope.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "diffoscope"

Fri Apr  8 22:46:31 2022 rev:31 rq:967911 version:209

Changes:
--------
--- /work/SRC/openSUSE:Factory/diffoscope/diffoscope.changes    2022-03-12 
17:16:00.818342848 +0100
+++ /work/SRC/openSUSE:Factory/.diffoscope.new.1900/diffoscope.changes  
2022-04-08 22:47:00.542279865 +0200
@@ -1,0 +2,25 @@
+Fri Apr  1 19:16:51 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- - update to version 209:
+ - Update R test fixture for R 4.2.x series. (Closes: #1008446)
+ - Update minimum version of Black to prevent test failure on Ubuntu jammy.
+- update to version 208:
+ - Add graceful handling for UNIX sockets and named pipes.
+   (Closes: reproducible-builds/diffoscope#292)
+ - Remove a superfluous log message and reformatt comment lines.
+ - Reformat various files to satisfy current version of Black.
+
+-------------------------------------------------------------------
+Fri Mar 25 21:21:18 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- - update to version 208:
+ - Add graceful handling for UNIX sockets and named pipes.
+   (Closes: reproducible-builds/diffoscope#292)
+ - Remove a superfluous log message and reformatt comment lines.
+ - Reformat various files to satisfy current version of Black.
+- update to version 207:
+ - Fix a gnarly regression when comparing directories against non-directories.
+   (Closes: reproducible-builds/diffoscope#292)
+ - Use our assert_diff utility where we can within test_directory.py
+
+-------------------------------------------------------------------

Old:
----
  diffoscope-207.tar.bz2
  diffoscope-207.tar.bz2.asc

New:
----
  diffoscope-209.tar.bz2
  diffoscope-209.tar.bz2.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ diffoscope.spec ++++++
--- /var/tmp/diff_new_pack.KDrUbP/_old  2022-04-08 22:47:01.182272762 +0200
+++ /var/tmp/diff_new_pack.KDrUbP/_new  2022-04-08 22:47:01.186272717 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           diffoscope
-Version:        207
+Version:        209
 Release:        0
 Summary:        In-depth comparison of files, archives, and directories
 License:        GPL-3.0-or-later

++++++ diffoscope-207.tar.bz2 -> diffoscope-209.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/debian/changelog 
new/diffoscope-209/debian/changelog
--- old/diffoscope-207/debian/changelog 2022-03-04 13:55:28.000000000 +0100
+++ new/diffoscope-209/debian/changelog 2022-03-27 10:23:06.000000000 +0200
@@ -1,3 +1,22 @@
+diffoscope (209) unstable; urgency=medium
+
+  * Update R test fixture for R 4.2.x series. (Closes: #1008446)
+  * Update minimum version of Black to prevent test failure on Ubuntu jammy.
+
+ -- Chris Lamb <la...@debian.org>  Sun, 27 Mar 2022 09:23:02 +0100
+
+diffoscope (208) unstable; urgency=medium
+
+  [ Brent Spillner ]
+  * Add graceful handling for UNIX sockets and named pipes.
+    (Closes: reproducible-builds/diffoscope#292)
+  * Remove a superfluous log message and reformatt comment lines.
+
+  [ Chris Lamb ]
+  * Reformat various files to satisfy current version of Black.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 25 Mar 2022 08:24:33 +0000
+
 diffoscope (207) unstable; urgency=medium
 
   * Fix a gnarly regression when comparing directories against non-directories.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/__init__.py 
new/diffoscope-209/diffoscope/__init__.py
--- old/diffoscope-207/diffoscope/__init__.py   2022-03-04 13:55:28.000000000 
+0100
+++ new/diffoscope-209/diffoscope/__init__.py   2022-03-27 10:23:06.000000000 
+0200
@@ -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 = "207"
+VERSION = "209"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/__init__.py 
new/diffoscope-209/diffoscope/comparators/__init__.py
--- old/diffoscope-207/diffoscope/comparators/__init__.py       2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/__init__.py       2022-03-27 
10:23:06.000000000 +0200
@@ -36,6 +36,7 @@
         ("missing_file.MissingFile",),
         ("symlink.Symlink",),
         ("device.Device",),
+        ("socket_or_fifo.SocketOrFIFO",),
         ("debian.DotChangesFile", "debian_fallback.DotChangesFile"),
         ("debian.DotDscFile", "debian_fallback.DotDscFile"),
         ("debian.DotBuildinfoFile", "debian_fallback.DotBuildinfoFile"),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/binary.py 
new/diffoscope-209/diffoscope/comparators/binary.py
--- old/diffoscope-207/diffoscope/comparators/binary.py 2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/binary.py 2022-03-27 
10:23:06.000000000 +0200
@@ -41,3 +41,7 @@
     def is_device(self):
         mode = os.lstat(self._name).st_mode
         return stat.S_ISCHR(mode) or stat.S_ISBLK(mode)
+
+    def is_socket_or_fifo(self):
+        mode = os.lstat(self._name).st_mode
+        return stat.S_ISSOCK(mode) or stat.S_ISFIFO(mode)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/cbfs.py 
new/diffoscope-209/diffoscope/comparators/cbfs.py
--- old/diffoscope-207/diffoscope/comparators/cbfs.py   2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/cbfs.py   2022-03-27 
10:23:06.000000000 +0200
@@ -97,7 +97,7 @@
 CBFS_HEADER_SIZE = 8 * 4  # 8 * uint32_t
 
 # On 2015-12-15, the largest image produced by coreboot is 16 MiB
-CBFS_MAXIMUM_FILE_SIZE = 24 * 2 ** 20  # 24 MiB
+CBFS_MAXIMUM_FILE_SIZE = 24 * 2**20  # 24 MiB
 
 
 def is_header_valid(buf, size, offset=0):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/debian.py 
new/diffoscope-209/diffoscope/comparators/debian.py
--- old/diffoscope-207/diffoscope/comparators/debian.py 2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/debian.py 2022-03-27 
10:23:06.000000000 +0200
@@ -68,6 +68,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
 
 class DebControlContainer(Container):
     def __init__(self, *args, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/decompile.py 
new/diffoscope-209/diffoscope/comparators/decompile.py
--- old/diffoscope-207/diffoscope/comparators/decompile.py      2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/decompile.py      2022-03-27 
10:23:06.000000000 +0200
@@ -183,6 +183,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
     if tlsh:
 
         @property
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/elf.py 
new/diffoscope-209/diffoscope/comparators/elf.py
--- old/diffoscope-207/diffoscope/comparators/elf.py    2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/elf.py    2022-03-27 
10:23:06.000000000 +0200
@@ -329,6 +329,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
     def has_same_content_as(self, other):
         # Always force diff of the section
         return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/macho.py 
new/diffoscope-209/diffoscope/comparators/macho.py
--- old/diffoscope-207/diffoscope/comparators/macho.py  2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/macho.py  2022-03-27 
10:23:06.000000000 +0200
@@ -67,6 +67,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
     def has_same_content_as(self, other):
         # Always force diff of the container
         return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-207/diffoscope/comparators/missing_file.py 
new/diffoscope-209/diffoscope/comparators/missing_file.py
--- old/diffoscope-207/diffoscope/comparators/missing_file.py   2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/missing_file.py   2022-03-27 
10:23:06.000000000 +0200
@@ -73,6 +73,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
     def compare(self, other, source=None):
         # So now that comparators are all object-oriented, we don't have any
         # clue on how to perform a meaningful comparison right here. So we are
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/rpm.py 
new/diffoscope-209/diffoscope/comparators/rpm.py
--- old/diffoscope-207/diffoscope/comparators/rpm.py    2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/rpm.py    2022-03-27 
10:23:06.000000000 +0200
@@ -39,10 +39,10 @@
 def convert_header_field(io, header):
     if isinstance(header, list):
         if len(header) == 0:
-            io.write(u"[]")
+            io.write("[]")
         else:
             for item in header:
-                io.write(u"\n - ")
+                io.write("\n - ")
                 convert_header_field(io, item)
         return
 
@@ -70,9 +70,9 @@
         for rpmtag in sorted(rpm.tagnames):
             if rpmtag not in hdr:
                 continue
-            s.write(u"{}: ".format(rpm.tagnames[rpmtag]))
+            s.write("{}: ".format(rpm.tagnames[rpmtag]))
             convert_header_field(s, hdr[rpmtag])
-            s.write(u"\n")
+            s.write("\n")
     return s.getvalue()
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-207/diffoscope/comparators/socket_or_fifo.py 
new/diffoscope-209/diffoscope/comparators/socket_or_fifo.py
--- old/diffoscope-207/diffoscope/comparators/socket_or_fifo.py 1970-01-01 
01:00:00.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/socket_or_fifo.py 2022-03-27 
10:23:06.000000000 +0200
@@ -0,0 +1,102 @@
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright ?? 2021 Brent Spillner <s p i l l n e r @ a c m . o r g>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import stat
+import logging
+
+from diffoscope.tempfiles import get_named_temporary_file
+from diffoscope.difference import Difference
+
+from .binary import FilesystemFile
+from .utils.file import File
+
+logger = logging.getLogger(__name__)
+
+
+class SocketOrFIFO(File):
+    DESCRIPTION = "local (UNIX domain) sockets and named pipes (FIFOs)"
+
+    @classmethod
+    def recognizes(cls, file):
+        return file.is_socket_or_fifo()
+
+    def get_type(self):
+        assert isinstance(self, FilesystemFile)
+        st = os.lstat(self.name)
+        return stat.S_IFMT(st.st_mode)
+
+    def has_same_content_as(self, other):
+        try:
+            # (filesystem ID, inode) pair uniquely identifies the socket/pipe
+            # Path comparison allows matching against pipes inside an archive
+            # (i.e. that would be created by extraction), while using 
.samefile()
+            # lets us match endpoints that might have more than one "canonical"
+            # pathname after a mount -o rebind
+            if self.get_type() != other.get_type():
+                return False
+            if os.path.exists(self.name) and os.path.exists(other.name):
+                return os.path.samefile(self.name, other.name)
+            return os.path.realname(self.name) == os.path.realname(other.name)
+        except (AttributeError, OSError):
+            # 'other' is likely something odd that doesn't support stat() 
and/or
+            # can't supply an fs_uuid/inode pair for samefile()
+            logger.debug(
+                "has_same_content: Not a socket, FIFO, or ordinary file: %s",
+                other,
+            )
+            return False
+
+    def create_placeholder(self):
+        with get_named_temporary_file(mode="w+", delete=False) as f:
+            f.write(format_socket(self.get_type(), self.name))
+            f.flush()
+            return f.name
+
+    @property
+    def path(self):
+        if not hasattr(self, "_placeholder"):
+            self._placeholder = self.create_placeholder()
+        return self._placeholder
+
+    def cleanup(self):
+        if hasattr(self, "_placeholder"):
+            os.remove(self._placeholder)
+            del self._placeholder
+        super().cleanup()
+
+    def compare(self, other, source=None):
+        with open(self.path) as my_content, open(other.path) as other_content:
+            return Difference.from_text_readers(
+                my_content,
+                other_content,
+                self.name,
+                other.name,
+                source=source,
+                comment="socket/FIFO",
+            )
+
+
+def format_socket(mode, filename):
+    if stat.S_ISSOCK(mode):
+        kind = "UNIX domain socket"
+    elif stat.S_ISFIFO(mode):
+        kind = "named pipe (FIFO)"
+    else:
+        kind = "ERROR: problem with an is_socket_or_fifo() predicate"
+    return f"{kind}: {filename}\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/squashfs.py 
new/diffoscope-209/diffoscope/comparators/squashfs.py
--- old/diffoscope-207/diffoscope/comparators/squashfs.py       2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/squashfs.py       2022-03-27 
10:23:06.000000000 +0200
@@ -33,6 +33,7 @@
 from .utils.file import File
 from .device import Device
 from .symlink import Symlink
+from .socket_or_fifo import SocketOrFIFO
 from .directory import Directory
 from .utils.archive import Archive, ArchiveMember
 from .utils.command import Command
@@ -72,6 +73,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
     @property
     def path(self):
         # Use our extracted version and also avoid creating a temporary
@@ -217,6 +221,42 @@
         return True
 
 
+class SquashfsFIFO(SocketOrFIFO, SquashfsMember):
+    # Example line:
+    # crw-r--r-- root/root  0 2021-08-18 13:37 run/initctl
+    LINE_RE = re.compile(
+        r"^(?P<kind>s|p)\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(?P<member_name>.*)$"
+    )
+
+    KIND_MAP = {"s": stat.S_IFSOCK, "p": stat.S_IFIFO}
+
+    @staticmethod
+    def parse(line):
+        m = SquashfsFIFO.LINE_RE.match(line)
+        if not m:
+            raise SquashfsInvalidLineFormat("invalid line format")
+
+        d = m.groupdict()
+        try:
+            d["mode"] = SquashfsFIFO.KIND_MAP[d["kind"]]
+            del d["kind"]
+        except KeyError:
+            raise SquashfsInvalidLineFormat(
+                f"unknown socket/FIFO kind {d['kind']}"
+            )
+        return d
+
+    def __init__(self, archive, member_name, mode):
+        SquashfsMember.__init__(self, archive, member_name)
+        self._mode = mode
+
+    def get_type(self):
+        return stat.S_IFMT(self._mode)
+
+    def is_socket_or_fifo(self):
+        return True
+
+
 class SquashfsContainer(Archive):
     auto_diff_metadata = False
 
@@ -225,6 +265,8 @@
         "l": SquashfsSymlink,
         "c": SquashfsDevice,
         "b": SquashfsDevice,
+        "p": SquashfsFIFO,
+        "s": SquashfsFIFO,
         "-": SquashfsRegularFile,
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-207/diffoscope/comparators/utils/archive.py 
new/diffoscope-209/diffoscope/comparators/utils/archive.py
--- old/diffoscope-207/diffoscope/comparators/utils/archive.py  2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/utils/archive.py  2022-03-27 
10:23:06.000000000 +0200
@@ -136,6 +136,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
 
 class MissingArchiveLikeObject(AbstractMissingType):
     def getnames(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/comparators/utils/file.py 
new/diffoscope-209/diffoscope/comparators/utils/file.py
--- old/diffoscope-207/diffoscope/comparators/utils/file.py     2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/utils/file.py     2022-03-27 
10:23:06.000000000 +0200
@@ -327,6 +327,7 @@
             (self.is_device, "device"),
             (self.is_symlink, "symlink"),
             (self.is_directory, "directory"),
+            (self.is_socket_or_fifo, "socket or FIFO"),
         ):
             if x():
                 return y
@@ -374,6 +375,10 @@
     def is_device():
         raise NotImplementedError()
 
+    @abc.abstractmethod
+    def is_socket_or_fifo():
+        raise NotImplementedError()
+
     def compare_bytes(self, other, source=None):
         from .compare import compare_binary_files
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/diffoscope-207/diffoscope/comparators/utils/libarchive.py 
new/diffoscope-209/diffoscope/comparators/utils/libarchive.py
--- old/diffoscope-207/diffoscope/comparators/utils/libarchive.py       
2022-03-04 13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/comparators/utils/libarchive.py       
2022-03-27 10:23:06.000000000 +0200
@@ -24,6 +24,7 @@
 import logging
 import libarchive
 import collections
+import stat
 
 from diffoscope.exc import ContainerExtractionError
 from diffoscope.config import Config
@@ -34,6 +35,7 @@
 from ..device import Device
 from ..symlink import Symlink
 from ..directory import Directory
+from ..socket_or_fifo import SocketOrFIFO
 
 from .archive import Archive, ArchiveMember
 
@@ -187,6 +189,9 @@
     def is_device(self):
         return False
 
+    def is_socket_or_fifo(self):
+        return False
+
 
 class LibarchiveDirectory(Directory, LibarchiveMember):
     def __init__(self, archive, entry):
@@ -241,6 +246,18 @@
         return True
 
 
+class LibarchiveFIFO(SocketOrFIFO, LibarchiveMember):
+    def __init__(self, container, entry):
+        LibarchiveMember.__init__(self, container, entry)
+        self._mode = entry.mode
+
+    def get_type(self):
+        return stat.S_IFMT(self._mode)
+
+    def is_socket_or_fifo(self):
+        return True
+
+
 class LibarchiveContainer(Archive):
     def open_archive(self):
         # libarchive is very very stream oriented an not for random access
@@ -283,6 +300,8 @@
             return LibarchiveSymlink(self, entry)
         if entry.isblk or entry.ischr:
             return LibarchiveDevice(self, entry)
+        if entry.isfifo:
+            return LibarchiveFIFO(self, entry)
 
         return LibarchiveMember(self, entry)
 
@@ -323,7 +342,7 @@
                 os.makedirs(os.path.dirname(dst), exist_ok=True)
                 try:
                     with open(dst, "wb") as f:
-                        for block in entry.get_blocks(block_size=2 ** 17):
+                        for block in entry.get_blocks(block_size=2**17):
                             f.write(block)
                 except Exception as e:
                     raise ContainerExtractionError(entry.pathname, e)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/config.py 
new/diffoscope-209/diffoscope/config.py
--- old/diffoscope-207/diffoscope/config.py     2022-03-04 13:55:28.000000000 
+0100
+++ new/diffoscope-209/diffoscope/config.py     2022-03-27 10:23:06.000000000 
+0200
@@ -43,16 +43,16 @@
         self.diff_context = 7
 
         # GNU diff cannot process arbitrary large files :(
-        self.max_diff_input_lines = 2 ** 22
+        self.max_diff_input_lines = 2**22
         self.max_diff_block_lines_saved = float("inf")
 
         # hard limits, restricts single-file and multi-file formats
-        self.max_report_size = defaultint(40 * 2 ** 20)  # 40 MB
-        self.max_diff_block_lines = defaultint(2 ** 10)  # 1024 lines
+        self.max_report_size = defaultint(40 * 2**20)  # 40 MB
+        self.max_diff_block_lines = defaultint(2**10)  # 1024 lines
         # structural limits, restricts single-file formats
         # semi-restricts multi-file formats
-        self.max_page_size = defaultint(40 * 2 ** 20)  # 4 MB
-        self.max_page_diff_block_lines = defaultint(2 ** 7)  # 128 lines
+        self.max_page_size = defaultint(40 * 2**20)  # 4 MB
+        self.max_page_diff_block_lines = defaultint(2**7)  # 128 lines
 
         self.max_text_report_size = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/diffoscope/presenters/text.py 
new/diffoscope-209/diffoscope/presenters/text.py
--- old/diffoscope-207/diffoscope/presenters/text.py    2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/diffoscope/presenters/text.py    2022-03-27 
10:23:06.000000000 +0200
@@ -34,7 +34,7 @@
 
 
 class TextPresenter(Presenter):
-    PREFIX = u"??? "
+    PREFIX = "??? "
     RE_PREFIX = re.compile(r"(^|\n)")
 
     def __init__(self, print_func, color):
@@ -76,13 +76,13 @@
             self.output("--- {}".format(difference.source1))
             self.output("+++ {}".format(difference.source2))
         elif difference.source1 == difference.source2:
-            self.output(u"????????? {}".format(difference.source1))
+            self.output("????????? {}".format(difference.source1))
         else:
-            self.output(u"???   --- {}".format(difference.source1))
-            self.output(u"????????? +++ {}".format(difference.source2))
+            self.output("???   --- {}".format(difference.source1))
+            self.output("????????? +++ {}".format(difference.source2))
 
         for x in difference.comments:
-            self.output(u"?????? {}".format(x))
+            self.output("?????? {}".format(x))
 
         diff = difference.unified_diff
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/tests/comparators/test_pcap.py 
new/diffoscope-209/tests/comparators/test_pcap.py
--- old/diffoscope-207/tests/comparators/test_pcap.py   2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/tests/comparators/test_pcap.py   2022-03-27 
10:23:06.000000000 +0200
@@ -45,7 +45,7 @@
 @skip_unless_tools_exist("tcpdump")
 def test_diff(differences):
     expected_diff = get_data("pcap_expected_diff")
-    assert differences[0].unified_diff[: 2 ** 13] == expected_diff[: 2 ** 13]
+    assert differences[0].unified_diff[: 2**13] == expected_diff[: 2**13]
 
 
 @skip_unless_tools_exist("tcpdump")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/tests/comparators/test_rdata.py 
new/diffoscope-209/tests/comparators/test_rdata.py
--- old/diffoscope-207/tests/comparators/test_rdata.py  2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/tests/comparators/test_rdata.py  2022-03-27 
10:23:06.000000000 +0200
@@ -2,7 +2,7 @@
 # diffoscope: in-depth comparison of files, archives, and directories
 #
 # Copyright ?? 2017 Ximin Luo <infini...@debian.org>
-# Copyright ?? 2017, 2020-2021 Chris Lamb <la...@debian.org>
+# Copyright ?? 2017, 2020-2022 Chris Lamb <la...@debian.org>
 #
 # 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,15 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
+import re
 import pytest
+import subprocess
 
 from diffoscope.comparators.gzip import GzipFile
 from diffoscope.comparators.rdata import RdbFile
 
 from ..utils.data import load_fixture, get_data, assert_diff
-from ..utils.tools import skip_unless_tools_exist
+from ..utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 
 
 rdb1 = load_fixture("test1.rdb")
@@ -32,6 +34,18 @@
 rdx2 = load_fixture("test2.rdx")
 
 
+def rscript_version():
+    val = subprocess.check_output(
+        ("Rscript", "--version"), stderr=subprocess.STDOUT
+    )
+
+    m = re.search(r"version (?P<version>[^\(]+)\s", val.decode("utf-8"))
+    if not m:
+        return "~0unknown"
+
+    return m.group("version")
+
+
 def test_identification(rdb1, rdx1):
     assert isinstance(rdb1, RdbFile)
     assert isinstance(rdx1, GzipFile)
@@ -58,6 +72,7 @@
 
 
 @skip_unless_tools_exist("Rscript")
+@skip_unless_tool_is_at_least("Rscript", rscript_version, "4.2.0")
 def test_item_rdb(differences_rdb):
     assert differences_rdb[0].source1.startswith("Rscript")
     assert_diff(differences_rdb[0], "rdb_expected_diff")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/tests/comparators/test_sockets.py 
new/diffoscope-209/tests/comparators/test_sockets.py
--- old/diffoscope-207/tests/comparators/test_sockets.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/diffoscope-209/tests/comparators/test_sockets.py        2022-03-27 
10:23:06.000000000 +0200
@@ -0,0 +1,118 @@
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright ?? 2017, 2020 Chris Lamb <la...@debian.org>
+# Copyright ?? 2021 Brent Spillner <s p i l l n e r @ a c m . o r g>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
+
+import os
+import socket
+import pytest
+
+from diffoscope.comparators.binary import FilesystemFile
+from diffoscope.comparators.socket_or_fifo import SocketOrFIFO, format_socket
+from diffoscope.comparators.utils.specialize import specialize
+
+from ..utils.data import get_data, load_fixture
+
+sample_textfile = "text_ascii1"
+sampletext = load_fixture(sample_textfile)
+
+
+def make_socket(path):
+    if os.path.exists(path):
+        os.remove(path)
+    sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+    sock.bind(path)
+    return specialize(FilesystemFile(path))
+
+
+def make_pipe(path):
+    if os.path.exists(path):
+        os.remove(path)
+    os.mkfifo(path)
+    return specialize(FilesystemFile(path))
+
+
+@pytest.fixture
+def endpoints(tmpdir):
+    def makename(tag):
+        return os.path.join(tmpdir, "test_" + tag)
+
+    test_points = zip(
+        [make_socket, make_socket, make_pipe, make_pipe],
+        map(makename, ["socket1", "socket2", "pipe1", "pipe2"]),
+    )
+    yield [(name, f(name)) for (f, name) in test_points]
+    for (_, name) in test_points:
+        os.remove(name)
+
+
+@pytest.fixture
+def expected_results(endpoints):
+    descriptions = [
+        format_socket(obj.get_type(), path) for (path, obj) in endpoints
+    ]
+    [sock1_desc, sock2_desc, pipe1_desc, pipe2_desc] = descriptions
+
+    # Prefix every line of the sample text file with '+' to predict RHS of the 
diff
+    sampletext_contents = get_data(sample_textfile)
+    sample_lines = sampletext_contents.count("\n")
+    added_text = "+" + "\n+".join(sampletext_contents.split("\n")[:-1]) + "\n"
+
+    sock_text_diff = (
+        "@@ -1 +1,{} @@\n".format(sample_lines) + "-" + sock1_desc + added_text
+    )
+    pipe_text_diff = (
+        "@@ -1 +1,{} @@\n".format(sample_lines) + "-" + pipe1_desc + added_text
+    )
+    sock_sock_diff = "@@ -1 +1 @@\n" + "-" + sock1_desc + "+" + sock2_desc
+    pipe_pipe_diff = "@@ -1 +1 @@\n" + "-" + pipe1_desc + "+" + pipe2_desc
+    sock_pipe_diff = "@@ -1 +1 @@\n" + "-" + sock1_desc + "+" + pipe1_desc
+    pipe_sock_diff = "@@ -1 +1 @@\n" + "-" + pipe1_desc + "+" + sock1_desc
+    yield (
+        sock_text_diff,
+        pipe_text_diff,
+        sock_sock_diff,
+        pipe_pipe_diff,
+        sock_pipe_diff,
+        pipe_sock_diff,
+    )
+
+
+def test_sockets(endpoints, expected_results, sampletext):
+    (names, objects) = zip(*endpoints)
+    (sock1, sock2, pipe1, pipe2) = objects
+    (
+        sock_text_diff,
+        pipe_text_diff,
+        sock_sock_diff,
+        pipe_pipe_diff,
+        sock_pipe_diff,
+        pipe_sock_diff,
+    ) = expected_results
+
+    assert isinstance(sock1, SocketOrFIFO)
+    assert isinstance(pipe1, SocketOrFIFO)
+
+    assert sock1.compare(sampletext).unified_diff == sock_text_diff
+    assert pipe1.compare(sampletext).unified_diff == pipe_text_diff
+
+    assert sock1.compare(sock1) == None
+    assert pipe1.compare(pipe1) == None
+    assert sock1.compare(sock2).unified_diff == sock_sock_diff
+    assert pipe1.compare(pipe2).unified_diff == pipe_pipe_diff
+    assert sock1.compare(pipe1).unified_diff == sock_pipe_diff
+    assert pipe1.compare(sock1).unified_diff == pipe_sock_diff
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/tests/data/rdb_expected_diff 
new/diffoscope-209/tests/data/rdb_expected_diff
--- old/diffoscope-207/tests/data/rdb_expected_diff     2022-03-04 
13:55:28.000000000 +0100
+++ new/diffoscope-209/tests/data/rdb_expected_diff     2022-03-27 
10:23:06.000000000 +0200
@@ -137,7 +137,7 @@
  
  .__NAMESPACE__. (environment) = 
  {
-     "S3methods" = "structure(character(0), .Dim = c(0L, 4L))"
+     "S3methods" = "structure(character(0), dim = c(0L, 4L))"
      "dynlibs" = "NULL"
      "exports" = "<environment>"
 -    "imports" = "list(base = TRUE, utils = c(aspell_package_Rd_files = 
"aspell_package_Rd_files", "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-207/tests/test_source.py 
new/diffoscope-209/tests/test_source.py
--- old/diffoscope-207/tests/test_source.py     2022-03-04 13:55:28.000000000 
+0100
+++ new/diffoscope-209/tests/test_source.py     2022-03-27 10:23:06.000000000 
+0200
@@ -257,7 +257,7 @@
     ]
 
 
-@skip_unless_tool_is_at_least("black", black_version, "21.12b0")
+@skip_unless_tool_is_at_least("black", black_version, "22.1.0")
 def test_code_is_black_clean():
     output = subprocess.check_output(
         ("black", "--diff", "."), stderr=subprocess.PIPE

Reply via email to