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 #11 received at 18449 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Pádraig Brady <P <at> draigBrady.com>,
 Vincent Lefevre <vincent <at> vinc17.net>, 18449 <at> debbugs.gnu.org
Subject: Re: bug#18449: "cat x >> x" error even when x is empty
Date: Thu, 11 Sep 2014 08:56:10 -0600
[Message part 1 (text/plain, inline)]
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 isn't empty, I wonder whether an error is correct if
>> POSIXLY_CORRECT is set. The result will typically depend on the
>> implementation and possibly be non-deterministic, but POSIX doesn't
>> seem to allow an error (except FS errors, such as disk full).

I've raised this as an issue for the Austin Group to rule on:
http://austingroupbugs.net/view.php?id=876

> 
> This is just a protection against non deterministic usage.
> I.E. if there is data in the file then it'll probably run
> until the file system is exhausted.  This is what happens
> on FreeBSD BTW, though I see that Solaris has the same
> protections as GNU.

I'm hoping that POSIX standardizes the existing practice of forbidding
known disk-filling operations.

> 
> I wouldn't be on for removing this protection which
> has existed from the initial GNU implementation.

My thoughts, too.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

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

Previous Next


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