From: Junio C Hamano <hidden> Date: 2016-06-15 22:42:12
Matthias Urlichs [off-list ref] writes:
quoted
quoted
Files /dev/null and b/file3 differ
Of course, with LANG=de_DE.UTF-8 the situation is worse ...
And at this point it becomes more and more tempting to have our
own internal diff generator, without relying on external diff.
A midway compromise solution would be to detect if either file
is binary ourselves and not to call diff but always say "Binary
files difer".
Of course, with LANG=de_DE.UTF-8 the situation is worse ...
A midway compromise solution would be to detect if either file
is binary ourselves and not to call diff but always say "Binary
files difer".
Actually, there's a better way:
$ diff -u /dev/null /tmp/ra
Binary files /dev/null and /tmp/ra differ
$ echo $?
2
So the trivial fix is to emit our own "Binary files FOO and BAR differ"
line if the exit status is 2.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
If a man will go as far as he can see, he will be able to see farther when
he gets there.
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:42:12
Hi,
On Fri, 18 Nov 2005, Matthias Urlichs wrote:
So the trivial fix is to emit our own "Binary files FOO and BAR differ"
line if the exit status is 2.
From my diff man page:
-- snip --
DIAGNOSTICS
An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble.
-- snap --
The exit value 2 is ambiguous for at least one version of GNU diff.
Hth,
Dscho
From my diff man page:
-- snip --
DIAGNOSTICS
An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble.
-- snap --
The exit value 2 is ambiguous for at least one version of GNU diff.
AFAIK, We have
0 - no difference
1 - produced a reasonable diff
1 - produced a bad diff because binary stuff starts
after 4096-or-whatever bytes and diff didn't notice
2 - didn't produce a diff -- binary files differ
2 - something else broke
Right now we simply don't consider the second -2- case, because we just
successfully wrote the two files in question; there's not *that* much
that can fail after that. The second -1- case is sufficiently rare too.
So I still think a "Just write a 'Binary files FOO and BAR differ' line
if the exit status is 2" rule would at least fix the current bug with
diff 2.8.7.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
<Knghtbrd> xtifr - beware of james when he's off his medication =3D>
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:42:12
Hi,
On Fri, 18 Nov 2005, Matthias Urlichs wrote:
Johannes Schindelin:
quoted
From my diff man page:
-- snip --
DIAGNOSTICS
An exit status of 0 means no differences were found, 1 means some
differences were found, and 2 means trouble.
-- snap --
The exit value 2 is ambiguous for at least one version of GNU diff.
AFAIK, We have
0 - no difference
1 - produced a reasonable diff
1 - produced a bad diff because binary stuff starts
after 4096-or-whatever bytes and diff didn't notice
2 - didn't produce a diff -- binary files differ
2 - something else broke
Right now we simply don't consider the second -2- case, because we just
successfully wrote the two files in question; there's not *that* much
that can fail after that. The second -1- case is sufficiently rare too.
So I still think a "Just write a 'Binary files FOO and BAR differ' line
if the exit status is 2" rule would at least fix the current bug with
diff 2.8.7.
Dunno. Am I the only one with an odd feeling about that?
Ciao,
Dscho
So I still think a "Just write a 'Binary files FOO and BAR differ' line
if the exit status is 2" rule would at least fix the current bug with
diff 2.8.7.
Dunno. Am I the only one with an odd feeling about that?
I don't really like it either, but frankly I'm not going to write a new
(or integrate an existing) diff implementation for 1.0 ... you want to
do it, feel free. ;-)
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
BOFH excuse #217:
The MGs ran out of gas.
And at this point it becomes more and more tempting to have our
own internal diff generator, without relying on external diff.
A midway compromise solution would be to detect if either file
is binary ourselves and not to call diff but always say "Binary
files difer".
Umm.. Why not just say "if the line after the 'diff' line doesn't start
with '@@ ', then it's a binary diff"?
And not care at _all_ about what it says.
We require unified diffs, and they _always_ start with '@@ ' after the
header. No need to check anything else.
Linus