bug-coreutils
[Top][All Lists]
Advanced

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

Re: rmdir -p foo/bar/nonexistent


From: Eric Blake
Subject: Re: rmdir -p foo/bar/nonexistent
Date: Mon, 10 Apr 2006 06:57:23 -0600
User-agent: Thunderbird 1.5 (Windows/20051201)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Koblinger Egmont on 4/10/2006 6:28 AM:
> Hi,
> 
> Using coreutils 5.94, the command
>   rmdir -p foo/bar/nonexistent
> does not remove the `foo' or `foo/bar' empty directories if the mentioned
> subdirectory (foo/bar/nonexistent) does not exist.

The POSIX wording is a bit ambiguous here
(http://www.opengroup.org/onlinepubs/009695399/utilities/rmdir.html).  It
states simply that when -p is in effect,

"Remove all directories in a pathname. For each dir operand:

   1. The directory entry it names shall be removed.
   2. If the dir operand includes more than one pathname component,
effects equivalent to the following command shall occur:

      rmdir -p $(dirname dir)"

One reading is that since step 1 fails, the entire rmdir command fails at
that point without attempting step 2.

But I think your request is valid - foo/bar/nonexistent is certainly
removed (since it never existed), then it looks like we can read POSIX as
requiring that the command should continue on to remove foo/bar and foo.
The only question now is what do other implementations (such as BSD or
Solaris) do in this case?

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEOlYz84KuGfSFAYARAhOhAJ98uOySh1bP+Aiw8hD03Ba1PFogKQCeKAq4
tFn8TA/OI0TVDuFMZGMui80=
=8SkT
-----END PGP SIGNATURE-----




reply via email to

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