bug-coreutils
[Top][All Lists]
Advanced

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

bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is docu


From: Paul Eggert
Subject: bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so.
Date: Tue, 04 Sep 2012 08:39:33 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0

On 09/04/2012 08:02 AM, Jim Meyering wrote:
> I'm not 100% sold on the idea that that final unlinkat
> call should be creating a dangling symlink (i.e., by removing
> the directory to which "s" points).

But that's what rmdir() and the rmdir command
are supposed to do.  That much, at least, is pretty clearly
specified by POSIX 2008.

But now I see that coreutils rmdir doesn't do that:

$ mkdir a
$ ln -s a b
$ rmdir b/
rmdir: failed to remove 'b/': Not a directory

Solaris 10 rmdir gets it right.  Interestingly enough,
Solaris 10's port of coreutils rmdir (/opt/sfw/bin/rmdir)
also gets it right: it executes rmdir("b/"),
which removes the directory.  This is coreutils 5.93,
so I assume at some point there was a regression?

A bit more investigation shows that rmdir("b/")
fails on Linux 3.2.0, succeeds on Solaris 10, but
fails on Solaris 11!  Curiouser and curiouser.  This
means the Solaris 11 rmdir command agrees with GNU/Linux
and they both disagree with POSIX and with Solaris 10.

The problem also affects other commands.  For example,
POSIX says this should work:

$ mkdir a
$ ln -s a b
$ mv b/ c

and should rename a to c.  It does work, on Solaris 11,
but with coreutils it fails and reports

mv: cannot move 'b/' to 'c': Not a directory






reply via email to

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