bug#18449: cat x x error even when x is empty

2014-09-11 Thread Vincent Lefevre
With coreutils 8.23 under Debian/unstable: ypig% : x ypig% cat x x cat: x: input file is output file ypig% POSIXLY_CORRECT=1 cat x x cat: x: input file is output file while there's no reason to return an error in this case: the file should just remain empty. Using the same file for input and

bug#18449: cat x x error even when x is empty

2014-09-11 Thread Pádraig Brady
On 09/11/2014 02:00 PM, Vincent Lefevre wrote: With coreutils 8.23 under Debian/unstable: ypig% : x ypig% cat x x cat: x: input file is output file ypig% POSIXLY_CORRECT=1 cat x x cat: x: input file is output file while there's no reason to return an error in this case: the file

bug#18449: cat x x error even when x is empty

2014-09-11 Thread Eric Blake
On 09/11/2014 07:20 AM, Pádraig Brady wrote: while there's no reason to return an error in this case: the file should just remain empty. Testing for an empty file is enough of an additional special case over the existing check for same files that I don't think it is worth it. BTW, when x

bug#18449: cat x x error even when x is empty

2014-09-11 Thread Vincent Lefevre
On 2014-09-11 14:20:06 +0100, Pádraig Brady wrote: On 09/11/2014 02:00 PM, Vincent Lefevre wrote: This may not seem really useful here, but this can potentially break scripts with things like: cat $foo $bar where $foo may be the same file as $bar only if it is empty. I'm

bug#18449: cat x x error even when x is empty

2014-09-11 Thread Leslie S Satenstein
: Thursday, September 11, 2014 9:20 AM Subject: bug#18449: cat x x error even when x is empty On 09/11/2014 02:00 PM, Vincent Lefevre wrote: With coreutils 8.23 under Debian/unstable: ypig% : x ypig% cat x x cat: x: input file is output file ypig% POSIXLY_CORRECT=1 cat x x cat: x: input

bug#18449: cat x x error even when x is empty

2014-09-11 Thread Paul Eggert
Eric Blake wrote: Testing for an empty file is enough of an additional special case over the existing check for same files that I don't think it is worth it. It's a really cheap check, as a system call is needed only when the input and output files are the same, and even then it's only an