[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6402: [PATCH] rm: added --directory (-d) option

From: Paul Eggert
Subject: bug#6402: [PATCH] rm: added --directory (-d) option
Date: Tue, 15 Jun 2010 11:59:23 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100423 Thunderbird/3.0.4

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]