[diffoscope] 01/01: Revert "Tentative fix for #863636"

Ximin Luo infinity0 at debian.org
Tue May 30 13:28:00 CEST 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch experimental
in repository diffoscope.

commit e28b540b0b289ce9fda70095160382799d7602a6
Author: Ximin Luo <infinity0 at debian.org>
Date:   Tue May 30 13:26:45 2017 +0200

    Revert "Tentative fix for #863636"
    
    This reverts commit a0cbfa867141f77763fc51a287afee46a2157c45.
    
    This should work in theory and does in practise *except* for the case of
    readelf where it works on small cases but fails for large cases and sometimes
    makes those cases worse, see the bug report for details.
---
 diffoscope/diff.py | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index f2a1366..a300217 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -187,13 +187,12 @@ def run_diff(fifo1, fifo2, end_nl_q1, end_nl_q2):
     return parser.diff
 
 class FIFOFeeder(threading.Thread):
-    def __init__(self, feeder, fifo_path, end_nl_q=None, *, daemon=True, early_eval=False):
+    def __init__(self, feeder, fifo_path, end_nl_q=None, *, daemon=True):
         os.mkfifo(fifo_path)
         super().__init__(daemon=daemon)
         self.feeder = feeder
         self.fifo_path = fifo_path
         self.end_nl_q = Queue() if end_nl_q is None else end_nl_q
-        self.early_eval = early_eval
         self._exception = None
         self._want_join = threading.Event()
 
@@ -223,24 +222,9 @@ class FIFOFeeder(threading.Thread):
             # Now clear the fd's nonblocking flag to let writes block normally.
             fcntl.fcntl(fifo_fd, fcntl.F_SETFL, 0)
             with open(fifo_fd, 'wb') as fifo:
-                # If early-eval is requested, run the feeder and store its output
-                # in a temporary file, *before* writing to the "real" fifo. This is
-                # necessary to force command-based diffs to run in parallel, see
-                # Debian #863636
-                feeder = self.feeder
-                if self.early_eval:
-                    temp_path = self.fifo_path + ".contents"
-                    with open(temp_path, 'wb') as temp:
-                        end_nl = feeder(temp)
-                    def feeder(fifo):
-                        with open(temp_path, 'rb') as f:
-                            for buf in iter(lambda: f.read(32768), b''):
-                                fifo.write(buf)
-                        return end_nl
-
                 # The queue works around a unified diff limitation: if there's
                 # no newlines in both don't make it a difference
-                end_nl = feeder(fifo)
+                end_nl = self.feeder(fifo)
                 self.end_nl_q.put(end_nl)
         except Exception as error:
             self._exception = error
@@ -257,7 +241,7 @@ def diff(feeder1, feeder2):
     fifo1_path = os.path.join(tmpdir, 'fifo1')
     fifo2_path = os.path.join(tmpdir, 'fifo2')
     with FIFOFeeder(feeder1, fifo1_path) as fifo1, \
-         FIFOFeeder(feeder2, fifo2_path, early_eval=True) as fifo2:
+         FIFOFeeder(feeder2, fifo2_path) as fifo2:
         return run_diff(fifo1_path, fifo2_path, fifo1.end_nl_q, fifo2.end_nl_q)
 
 def reverse_unified_diff(diff):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list