--- Begin Message ---
Subject: |
Bug#737180: diffutils: diff exit status is 2 instead of 1 on binary files that differ (fwd) |
Date: |
Fri, 31 Jan 2014 11:08:20 +0100 (CET) |
User-agent: |
Alpine 2.02 (DEB 1266 2009-07-14) |
Hello.
I received this report from the Debian bug system.
Thanks.
---------- Forwarded message ----------
From: Vincent Lefevre <address@hidden>
To: Debian Bug Tracking System <address@hidden>
Date: Fri, 31 Jan 2014 03:06:13 +0100
Subject: Bug#737180: diffutils: diff exit status is 2 instead of 1 on binary
files that differ
Package: diffutils
Version: 1:3.3-1
Severity: normal
When diffing binary files that differ, e.g.
$ diff /usr/share/doc/diffutils/changelog.Debian.gz
/usr/share/doc/diffutils/changelog.gz
Binary files /usr/share/doc/diffutils/changelog.Debian.gz and
/usr/share/doc/diffutils/changelog.gz differ
zsh: exit 2 diff /usr/share/doc/diffutils/changelog.Debian.gz
I get exit status 2 instead of 1.
The diff(1) man page says:
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
We are in the case where the inputs are different, so that the
exit status should be 1.
Because of this bug, "svn diff --force --diff-cmd diff" fails on
binary files (ditto on more useful cases in practice, where a diff
wrapper is used to recognize some binary files, using the default
diff behavior as a fallback).
[...]
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug-diffutils] bug#16608: Bug#737180: diffutils: diff exit status is 2 instead of 1 on binary files that differ (fwd) |
Date: |
Fri, 31 Jan 2014 17:21:42 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
Vincent Lefevre wrote:
POSIX actually specifies the behavior:
Ouch, right you are. I recall reading POSIX and coming to the opposite
conclusion, that the behavior was not specified. Perhaps this was long
ago and input files were required to be text files.
Anyway, since it's incompatible with other 'diff' implementations and
with POSIX, and since there's not a particularly strong reason to
differ, let's change to be compatible. I applied the attached patch to
the savannah master and am taking the liberty of marking this as done;
please give it a try.
0001-diff-exit-with-status-1-not-2-when-binary-files-diff.patch
Description: Text document
--- End Message ---