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


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

From: Linda Walsh <coreutils <at> tlinx.org>
To: bug-coreutils <at> gnu.org
Subject: Bug: rm -fr . doesn't dir depth first deletion yet it is documented
	to do so.
Date: Sun, 02 Sep 2012 17:32:17 -0700
I'm not sure what the rational for putting in special check to
try to remove the current directory *before*, it's children is,
but it's not correct behavior.

It used to be it just 'ignored' an attempt to delete the current dir
and deleted all the files under it. 

Now there seems to be a special check for "." and disallow it as a
rm target.  But that was a safe and portable way to delete all contents.

can't use '*', -- it is expanded differently depending on shell and 
settings!

I always felt a bit safer if I was able to cd into the dir I wanted, then
rm -fr from the root of that dir by specifying '.'

Could that be added back in as a safe and portable way to do rm *, where I
don't have to worry about whether or not it applies the * will pick up
hidden files.

I would expect it to delete all but the current inode I'm parked on, and
for it -- either issue an error or silently ignore ... preferring 'DoWIMean'
versus 'technically'...as being more user friendly.

Sides -- it normally does depth-first traversal --- since you can't delete
a dir with contents still in it -- so why different for '.'?






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.