Mail Archives: djgpp/1998/06/21/08:09:08
On 19 Jun 1998, Ruiter de M wrote:
> bash$ diff -q file1 file2
> Files file1 and file2 differ
> bash$ diff -s file1 file2
> Files file1 and file2 are identical
>
> Especially the last lines are very entertaining: identical files
> differ! I could understand both answers, but not both at once.
You can hardly blame `diff' for the brain-damage of Microsoft-style
text vs. binary files hassles. What `diff' tries very hard to do is
to provide useful results and leave you (and me) sane in all possible
cases, and still report accurate output. If you find that amusing,
then so be it ;-).
More to the point, by default, `diff' reads the files in text mode
unless it detects binary characters (which in this case aren't
there), so these two files are read as text and compare equal. But -q
implies binary reads, so the files compare different when you use -q
(`cmp' would say that also).
> Is this a bug or have I missed some documentation?
You have missed a prolonged description of the ``binary files'' issue
in the `diff' manual. Look it up by typing this from the DOS prompt:
info diff Comparison Binary
- Raw text -