GNU bug report logs -
#12339
Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so.
Previous Next
Reported by: Linda Walsh <coreutils <at> tlinx.org>
Date: Mon, 3 Sep 2012 00:34:02 UTC
Severity: normal
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #194 received at 12339 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 09/07/2012 03:20 PM, Eric Blake wrote:
> Indeed, reading the original V7 source code from 1979:
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/rm.c
>
> shows that _only_ ".." was special, "." was attempted in-place and
> didn't fail until the unlink(".") after the directory itself had been
> emptied. It wasn't until later versions of code that "." also became
> special.
>
> You therefore may have a valid point that POSIX standardized something
> that did not match existing practice at the time, and therefore, it
> would be reasonable to propose a POSIX defect that requires early
> failure on "..", but changes the behavior on "." and "/" to only permit,
> but not require, early failure. However, I just checked, and the
> prohibition for an early exit on "." has been around since at least
> POSIX 2001, so you are now coming into the game at least 11 years late.
In addition to Alan's argument that 4.3BSD forbade '.' before POSIX
began (and therefore the POSIX folks DID standardize existing practice,
even it wasn't universally common at the time), I find this statement
from POSIX quite informative (line 104265 in POSIX 2008), on why any
proposal to allow 'rm -rf .' to remove non-dot files will probably be
denied:
>> The rm utility is forbidden to remove the names dot and dot-dot in order to avoid the consequences of inadvertently doing something like:
>> rm −r .*
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 6 years and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.