GNU bug report logs - #12339
Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so.

Previous Next

Package: coreutils;

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


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: Linda Walsh <coreutils <at> tlinx.org>, "12339 <at> debbugs.gnu.org" <12339 <at> debbugs.gnu.org>
Subject: bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is	documented to do so.
Date: Mon, 03 Sep 2012 22:32:23 -0700
On 09/03/2012 10:20 PM, Bernhard Voelker wrote:
> the question is what rm should remove:
> the symlink or the target?

The convention in POSIX is that if a symlink is
followed by '/', it's dereferenced.  So this does
appear to be a bug in coreutils 'rm'.

I confirmed that the bug does not occur with
Solaris 11 'rm':

$ mkdir d
$ touch d/file
$ ln -s d dl
$ ls -al *
lrwxrwxrwx   1 eggert   faculty        1 Sep  3 22:26 dl -> d

d:
total 16
drwxrwxr-x   2 eggert   faculty      178 Sep  3 22:26 .
drwxrwxr-x   3 eggert   faculty      234 Sep  3 22:26 ..
-rw-rw-r--   1 eggert   faculty        0 Sep  3 22:26 file
$ rm -r dl/
$ ls -al *
lrwxrwxrwx   1 eggert   faculty        1 Sep  3 22:26 dl -> d


Thanks for reminding me about "." and explaining
why the other example is not a bug.





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.