GNU bug report logs - #7775
rm -f emits no error message when deleting nonexistent file

Previous Next

Package: coreutils;

Reported by: Jeremy Hetzler <jeremyhetzler <at> gmail.com>

Date: Mon, 3 Jan 2011 15:55:01 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 7775 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Jeremy Hetzler <jeremyhetzler <at> gmail.com>
Cc: 7775 <at> debbugs.gnu.org
Subject: Re: bug#7775: rm -f emits no error message when deleting nonexistent
	file
Date: Mon, 03 Jan 2011 10:00:21 -0700
[Message part 1 (text/plain, inline)]
On 01/03/2011 08:12 AM, Jeremy Hetzler wrote:
> rm normally produces an error when you delete a nonexistent file. However,
> under -f, you get no error message. I would argue this is a bug.

Thanks for the report; however, this behavior is by design, and required
by POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

> 1. If the file does not exist:
> 
>    a. If the -f option is not specified, rm shall write a diagnostic message to standard error.
>    b. Go on to any remaining files.

That is, the whole point of -f is to silence warnings, including
warnings about non-existent files.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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

This bug report was last modified 14 years and 200 days ago.

Previous Next


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