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: "Linda A. Walsh" <law <at> tlinx.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Jim Meyering <meyering <at> redhat.com>, "12339 <at> debbugs.gnu.org" <12339 <at> debbugs.gnu.org>
Subject: bug#12339: [PATCH] rm: avoid bogus diagnostic for a slash-decorated symlink-to-dir
Date: Tue, 04 Sep 2012 18:55:52 -0700
[Message part 1 (text/plain, inline)]
Paul Eggert wrote:
> On 09/04/2012 04:21 PM, Linda A. Walsh wrote:> Paul Eggert wrote:
>
>   
>> expecting it to do nothing useful other than issue an error?
>>     
>
> Sure.  People might expect the utility to complain about
> what they consider to be obvious typos, rather than to
> remove files they don't expect to be removed.  For example:
>
>   rm -fr .*
>
> safely removes all file names beginning with "." in the
> working directory, without inadvertently removing file names
> that do not begin with ".", or files in the parent
> directory.  I can see people being used to this sort of
> thing, and being annoyed greatly if we change it.
>   
----
  i wouldn't regard that as safe.

I always use rm -fr .[^.]*

Why is that interfaces must sync to the lowest level.

unix was NOT supposed to be that way.

>   
>> Ok, will foo/ remove the contents only and not the directory?
>>     
>
> No, "rm -fr foo/" removes the directory too.
>   
So how do delete all files in the directory without wild cards?

(as you don't know how or if they will be expanded).

(only VERY recently has bash included "." in "*" -- it used to be 
ignored and
still is if you have flags set to ignore it.

Shells don't consistently expand wildcards, and the OS doesn't expand them
at all (i.e. when passed in 'exec')...

This is what I mean about useful features being removed in order to dumb 
down
the interface -- as dir/" also tries to remove the dir... which isn't
likely to work on a mount point.


[Message part 2 (text/html, inline)]

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.