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

From: Paul Eggert <[email-masked]>
Date: Mon, 24 Mar 2014 08:27:17 -0700

Eric Blake wrote:
> special-casing '-' to read stdin twice makes more sense, at
> least when fstat(0) says that stdin is not a regular file (the way that
> 'cat - -' behaves differently for stdin used twice).

The difference in behavior is inherent to what the two commands need to 
do.  'cat - -' must read standard input, whereas 'diff - -' needn't. 
It's like 'cmp -s - -'.

Here's another difference, which is also OK: 'diff -q - /etc/passwd' 
need not read standard input until EOF.  It can simply read stdin until 
it finds a difference, just as 'cmp -s - /etc/passwd' can.  'cat - 
/etc/passwd' doesn't have that liberty.