From e71903fc6101f1c039d702e335b08aad1e1b4100 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 9 Aug 2009 13:41:20 -0500 Subject: [PATCH] =?utf8?q?=E2=80=9Cxzdiff=20a.xz=20b.xz=E2=80=9D=20always?= =?utf8?q?=20fails?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Attempts to compare two compressed files result in no output and exit status 2. Instead of going to standard output, ‘diff’ output is being captured in the xz_status variable along with the exit status from the decompression commands. Later, when this variable is examined for nonzero status codes, numerals from dates in the ‘diff’ output make it appear as though decompression failed. So let the ‘diff’ output leak to standard output with another file descriptor. (This trick is used in all similar contexts elsewhere in xzdiff and in the analogous context in gzip’s zdiff script.) --- src/scripts/xzdiff.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/xzdiff.in b/src/scripts/xzdiff.in index fc1e057..2d6e5da 100644 --- a/src/scripts/xzdiff.in +++ b/src/scripts/xzdiff.in @@ -118,7 +118,7 @@ elif test $# -eq 2; then exec 4>&1 ($xz1 -cdfq -- "$1" 4>&-; echo $? >&4) 3>&- | ( ($xz2 -cdfq -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- &3) 5<&0 ) case $xz_status in *[1-9]*) xz_status=1;; -- 2.39.2