|
From: | Paul Eggert |
Subject: | [bug-diffutils] bug#17075: bug#17075: bug#17075: diff - - exits immediately |
Date: | Mon, 24 Mar 2014 08:27:17 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |