Subject: bug#18449: "cat x >> x" error even when x is empty

From: Vincent Lefevre <[email-masked]>
Date: Thu, 11 Sep 2014 17:46:56 +0200

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 struggling to see that use case TBH.

Seriously, I don't know whether this could occur in practice, but if
it does, I wouldn't be surprised. If this may be regarded as an error,
it is important that this is specified; the issue raised by Eric for
the Austin Group may makes this clear. Let's just hope that users
won't forget this particular case.

As a comparison, one may think that in C, a shift like 0 << n, where
n >= int width, would never occur in practice, but it did in one of
my codes (I made sure that there was no integer overflow but forgot
the constraint on the shift count, which adds a restriction only when
the first argument is 0).

-- 
Vincent Lefèvre <[email-masked]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)