GNU bug report logs -
#6402
[PATCH] rm: added --directory (-d) option
Previous Next
Reported by: Eric Blake <eblake <at> redhat.com>
Date: Fri, 11 Jun 2010 15:15:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Paul Eggert wrote:
> On 06/11/2010 08:13 AM, Eric Blake wrote:
>
>> I would need to understand if there is any difference
>> between 'rmdir dir' (specified by POSIX) and 'rm -d dir' - if they are
>> no different, then how do you justify the extension?
>
> I briefly looked at the FreeBSD source code, and there's essentially no
> difference. The "-d" option causes BSD "rm" to use the rmdir system call
> rather than the unlink system call. There is a minor difference if you
> use the "-P" option to shred on the file before removing it, in that
> "rm -dP" does not attempt to shred a directory, but that minor difference
> doesn't apply to coreutils where "shred" is a separate executable.
>
> I'm dubious about this "rm -d" flag. It's clearly not
> portable, and (despite a search) I couldn't find any record of anybody
> seriously using it. On the contrary, all the uses I found of "rm -d" were
> errors; e.g., people incorrectly thought that "rm -dr FOO" would recursively
> move the directory tree rooted at FOO.
>
> Since "rm -d" causes confusion and provides no extra utility over "rmdir"
> that I can see, I suggest that we instead change "rm -d" to report an error,
> much as "rm -X" does for other offbeat values of X.
Thanks for doing that research. I like your idea.
I too would prefer to discourage the use of rm's -d option.
This bug report was last modified 14 years and 36 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.