GNU bug report logs - #18449
"cat x >> x" error even when x is empty

Previous Next

Package: coreutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Thu, 11 Sep 2014 13:02: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 18449 <at> debbugs.gnu.org (full text, mbox):

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 18449 <at> debbugs.gnu.org
Subject: Re: bug#18449: "cat x >> x" error even when x is empty
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 <vincent <at> vinc17.net> - 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)




This bug report was last modified 10 years and 251 days ago.

Previous Next


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