delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/21/08:09:08

Date: Sun, 21 Jun 1998 14:29:44 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ruiter de M <mdruiter AT cs DOT vu DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: Bug in DJGPP port of diff?
In-Reply-To: <6mdqnj$s18$1@star.cs.vu.nl>
Message-ID: <Pine.SUN.3.91.980621142837.5335S-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019