bug-coreutils
[Top][All Lists]
Advanced

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

bug#20835: rmdir foo/. fails


From: Pádraig Brady
Subject: bug#20835: rmdir foo/. fails
Date: Wed, 17 Jun 2015 11:53:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

tag 20835 notabug
close 20835
stop

On 17/06/15 11:24, Ed Avis wrote:
> % mkdir foo
> % rmdir foo/.
> rmdir: failed to remove ‘foo/.’: Invalid argument
> % rmdir --version
> rmdir (GNU coreutils) 8.23
> Copyright (C) 2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by David MacKenzie.
> 
> 
> I suggest that 'rmdir foo/.' should be equivalent to 'rmdir foo'.
> Strangely, 'rmdir foo/..' does work as expected (that is, it fails with
> 'Directory not empty').
> 
> Note that Emacs command completion (in shell-mode) will complete foo to foo/.

rmdir(2) explicitly states:
  EINVAL pathname has .  as last component.

POSIX states that:
  "If the path argument refers to a path whose final component
   is either dot or dot-dot, rmdir() shall fail."

  "The meaning of deleting pathname/. is unclear, because the name
   of the file (directory) in the parent directory to be removed is
   not clear, particularly in the presence of multiple links to a directory."

I see Solaris and FreeBSD also disallow this.

thanks,
Pádraig.





reply via email to

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