GNU bug report logs - #17075
diff - - exits immediately

Previous Next

Package: diffutils;

Reported by: karl <at> freefriends.org (Karl Berry)

Date: Sun, 23 Mar 2014 21:22:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 17075 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eric Blake <eblake <at> redhat.com>, Karl Berry <karl <at> freefriends.org>, 
 17075 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#17075: bug#17075: diff - - exits immediately
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.




This bug report was last modified 11 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.