Subject: Re: [bug-diffutils] bug#17075: diff - - exits immediately

From: Paul Eggert <[email-masked]>
Date: Tue, 25 Mar 2014 18:06:53 -0700

Karl Berry wrote:
> I think it would be better to say*something*  about the fact that
> diff does not always read its input, in the event that it can determine the
> result via other methods.

Thanks, that sounds good; I installed the attached.

 > This is so unlike virtually every other program

Hmm, well, in diff's defense, lots of commonly-used programs avoid 
reading some or all their input in some cases, including 'grep', 'head', 
'tail', 'sed', 'awk', 'dd', 'more', and 'od'.  It's not just 'diff' and 
'cmp'.
From 65183824861ca10f39e934d940c9be4b821f8f2a Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Tue, 25 Mar 2014 17:55:26 -0700
Subject: [PATCH] doc: improve documentation about reading and stdin

See Bug#17075.
* doc/diffutils.texi (Comparison): Say that files need not be read.
(Invoking diff): Remove confusing remark about 'diff - -'.
It's not that useful, and it's not portable anyway.
---
 doc/diffutils.texi | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/diffutils.texi b/doc/diffutils.texi
index 7b08cd4..022fb8d 100644
--- a/doc/diffutils.texi
+++ b/doc/diffutils.texi
@@ -219,6 +219,11 @@ groups of lines that differ, and reports each group of differing lines.
 Its output is designed to make it easy to inspect two different sets of
 changes to the same file.
 
+These commands compare input files without necessarily reading them.
+For example, if @command{diff} is asked simply to report whether two
+files differ, and it discovers that the files have different sizes, it
+need not read them to do its job.
+
 @menu
 * Hunks::             Groups of differing lines.
 * White Space::       Suppressing differences in white space.
@@ -3672,8 +3677,7 @@ diff @var{options}@dots{} @var{files}@dots{}
 In the simplest case, two file names @var{from-file} and
 @var{to-file} are given, and @command{diff} compares the contents of
 @var{from-file} and @var{to-file}.  A file name of @file{-} stands for
-text read from the standard input.  As a special case, @samp{diff - -}
-compares a copy of standard input to itself.
+the standard input.
 
 If one file is a directory and the other is not, @command{diff} compares
 the file in the directory whose name is that of the non-directory.
-- 
1.8.5.3