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

Previous Next

Package: coreutils;

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


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

From: Paul Eggert <eggert <at> CS.UCLA.EDU>
To: Eric Blake <eblake <at> redhat.com>
Cc: 6402 <at> debbugs.gnu.org, pwplusnick2 <at> gmail.com
Subject: Re: bug#6402: [PATCH] rm: added --directory (-d) option
Date: Tue, 15 Jun 2010 11:59:23 -0700
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.




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.