bug-coreutils
[Top][All Lists]
Advanced

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

bug#19051: rm symboliclink/ # "Is a directory"


From: Eric Blake
Subject: bug#19051: rm symboliclink/ # "Is a directory"
Date: Fri, 14 Nov 2014 06:15:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/14/2014 04:41 AM, Pádraig Brady wrote:
> tag 19051 notabug
> close 19501
> stop
> 
> On 14/11/14 06:53, aaron brick wrote:
>> hi folks,
>>
>> $ ln -s / sl
>> $ rm sl/
>> rm: cannot remove `sl/': Is a directory
>> $ rm sl
>> $
>>

> 
> Confused me too when I encountered it first, but tt's required by POSIX:
> http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11

No, actually, POSIX requires that it (attempt to) remove the DIRECTORY,
not the symlink.  Linux is intentionally in violation of POSIX on this
front.

Try this on Solaris:

$ mkdir a
$ ln -s a b
$ rm b/
$ ls -d ?
b

> 
> But now I see that coreutils rmdir is inconsistent and doesn't
> treat sl/ as the directory. We should probably fix that up
> to be consistent with other tools, POSIX and other systems.

We've had this conversation in the past.  The fact that Linux
intentionally violates POSIX is actually useful; the POSIX behavior
leaves behind dangling symlinks, whereas the Linux behavior makes some
sort of sense (even if not the best quality errno values).  Our decision
has been that we choose NOT to override kernel semantics on this front;
waiting for either the kernel folks to obey POSIX (unlikely) or for
POSIX to relax and concede that the Linux behavior is a useful
alternative and allow it in addition to Solaris behavior (possible, but
I haven't tried pushing hard for it lately).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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