1
0
зеркало из https://git.tukaani.org/xz.git synced 2025-12-13 08:58:45 +00:00

“xzdiff a.xz b.xz” always fails

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.)
Этот коммит содержится в:
Jonathan Nieder 2009-08-09 13:41:20 -05:00 коммит произвёл Lasse Collin
родитель 1d314b81aa
Коммит e71903fc61

Просмотреть файл

@ -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<&- </dev/null |
eval "$cmp" /dev/fd/5 -) 5<&0
eval "$cmp" /dev/fd/5 - >&3) 5<&0
)
case $xz_status in
*[1-9]*) xz_status=1;;