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.
