GNU bug report logs - #19051
rm symboliclink/ # "Is a directory"

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: aaron brick <abrick@HIDDEN>; Keywords: notabug; dated Fri, 14 Nov 2014 07:20:01 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Added tag(s) notabug. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 21 Nov 2014 19:40:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 21 14:40:41 2014
Received: from localhost ([127.0.0.1]:41246 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Xru4N-0005K2-49
	for submit <at> debbugs.gnu.org; Fri, 21 Nov 2014 14:40:39 -0500
Received: from ishtar.tlinx.org ([173.164.175.65]:52706
 helo=Ishtar.hs.tlinx.org) by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <coreutils@HIDDEN>) id 1Xru4E-0005Jf-6T
 for 19051 <at> debbugs.gnu.org; Fri, 21 Nov 2014 14:40:31 -0500
Received: from [192.168.4.12] (Athenae [192.168.4.12])
 by Ishtar.hs.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id
 sALJdINC089408; Fri, 21 Nov 2014 11:39:22 -0800
Message-ID: <546F94E7.8060200@HIDDEN>
Date: Fri, 21 Nov 2014 11:39:19 -0800
From: Linda Walsh <coreutils@HIDDEN>
User-Agent: Thunderbird
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>	<5465EA85.7070705@HIDDEN>
 <5466006C.5000507@HIDDEN> <54661610.7000105@HIDDEN>
In-Reply-To: <54661610.7000105@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 19051
Cc: aaron brick <abrick@HIDDEN>, 19051 <at> debbugs.gnu.org, Pádraig Brady <P@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Eric Blake wrote:
> Still, my point remains when you use 'rm -r b/': on Linux, it fails
----
    (so does 'rm -r b@' as a symlink to a file). 

    The linux way to address the directory has been "rm -r b/." POSIX 
blocked the linux
way of addressing the directory in rm, though, for example, it still 
works in
'cp': "cp -rl b/. a/." correctly makes links in 'a/.' of 'b/.' files.  
But it doesn't see the "." in
a and fail to execute normally.  In fact, attempting that copy isn't 
even an error in 'cp'/,
even though.   "b/." is a symlink to "a/."

    This came up before with symlinked targets and 'rm' and supposedly 
core utils would
always attempt a dir-op with "/" appended, but try a symlink-op w/o it.

Linux is behaving consistently, in that "rm" applies to symlinks, not 
the targets.

On linux to address the content of a directory, "dir/." has generally 
been used, but
as you mention below, POSIX intentionally violated the linux behavior in 
its 2008 update.
I.e. the linux behavior was prsent long before POSIX was changed to 
prevent the linux
addressing strategy

   
> (cannot remove 'b/': Not a directory), on Solaris it succeeds at
> removing 'a' and leaving 'b' dangling.
>
> The fact that Linux intentionally violates POSIX on some of the corner
> cases related to symlinks to directories makes it harder to definitively
> state what coreutils should do.
>   
---
Posix semantics changing away from the original POSIX standard break the 
"portability"
aspect of the POSIX, and, are hard to take seriously as being a 
portability standard when it
can't even maintain standards between it's own versions.  Given the 
relative number of users
of the various *nix's, It sorta looks like POSIX is attempting to wag 
the dog.

I strongly question the logic in linux following some minority standard 
when the largest
user base is likely to be used to the linux behavior.











Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 14 Nov 2014 20:23:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 15:23:53 2014
Received: from localhost ([127.0.0.1]:32892 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpNPN-0002Gk-9Q
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 15:23:53 -0500
Received: from mail-ie0-f173.google.com ([209.85.223.173]:45934)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bricktron@HIDDEN>) id 1XpNPK-0002Gb-6W
 for 19051 <at> debbugs.gnu.org; Fri, 14 Nov 2014 15:23:51 -0500
Received: by mail-ie0-f173.google.com with SMTP id y20so1780050ier.18
 for <19051 <at> debbugs.gnu.org>; Fri, 14 Nov 2014 12:23:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:content-type;
 bh=k08YTHiFa6rynjfSo5Y3nQcZWTMpDmj6ho4V0HYIRdw=;
 b=EiaAYW1xg6ttp3/S1fbHMD/5Lz3Vna7QgA+YT6/zKkbBA8bzkD1BUw5eM+fDNklFkU
 994uEGePj4f90lO8esPoPJsj3ukMX/YvRm8DXVZVd1xGsOzfHU8iBmuN7C1Mt/uO61+H
 HgexJBZVC53Yj5F0Pvm73cz9t7lNW8d1dtDlx4dAakg7lHq4fk6Eu0YOJqc13naDvUok
 h/2BqANFF5ZQEWCudtCrkThLnqvbcJo85ooIeaFS+6Yi8UodzrbvgV5U9TdWwGU6YOyz
 k8y1burVyY+LDKkF6lCdDgzPxLxynJSV0GOsIFGc73ygeMpE/2Ea9lfuM8DF9yVD06yD
 0sIA==
X-Received: by 10.43.99.3 with SMTP id cq3mr13409673icc.49.1415996629472; Fri,
 14 Nov 2014 12:23:49 -0800 (PST)
MIME-Version: 1.0
Received: by 10.50.100.163 with HTTP; Fri, 14 Nov 2014 12:23:29 -0800 (PST)
In-Reply-To: <54661610.7000105@HIDDEN>
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
 <5465EA85.7070705@HIDDEN> <5466006C.5000507@HIDDEN>
 <54661610.7000105@HIDDEN>
From: aaron brick <abrick@HIDDEN>
Date: Fri, 14 Nov 2014 12:23:29 -0800
X-Google-Sender-Auth: zOi29c_KH8jZuQPEMUmWe0E7F2E
Message-ID: <CANfomjKyPB1cp58t8RXgowrg-ve+2MXgKdE2HmAhyn_k2oe+YA@HIDDEN>
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
To: 19051 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 19051
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

thanks for your time and comments folks!


On Fri, Nov 14, 2014 at 6:47 AM, Eric Blake <eblake@HIDDEN> wrote:
> On 11/14/2014 06:15 AM, Eric Blake wrote:
>
>>> 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
>
> Uggh, serves me right for typing without testing.  I'm mixing up
> rename(), unlink(), and rmdir() semantics.  Basically,
> unlink("anything/") is required by POSIX to fail because the trailing /
> means that the only thing to be removed is a directory, but directories
> can only be removed by rmdir(), not unlink().
>
> Still, my point remains when you use 'rm -r b/': on Linux, it fails
> (cannot remove 'b/': Not a directory), on Solaris it succeeds at
> removing 'a' and leaving 'b' dangling.
>
> The fact that Linux intentionally violates POSIX on some of the corner
> cases related to symlinks to directories makes it harder to definitively
> state what coreutils should do.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>




Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 14 Nov 2014 14:48:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 09:48:04 2014
Received: from localhost ([127.0.0.1]:60332 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpIAN-0007SL-Pm
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 09:48:04 -0500
Received: from mail6.vodafone.ie ([213.233.128.184]:29582)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1XpIAL-0007Rg-Ks
 for 19051 <at> debbugs.gnu.org; Fri, 14 Nov 2014 09:48:02 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AjgKAO8VZlRtT6OH/2dsb2JhbABbDoMAVVkBgjVQiDvBR4Z3UgECAoEfFgEBAQEBfYQCAQEBAwEjDwFLCwsNAQoCAgUWCwICCQMCAQIBRQYBDAgBAYg0DQEIuy2GDZAwDCCBLY98gneBVAWQH4cDiF49hjuKRIQKgzxAPTABgkoBAQE
Received: from unknown (HELO localhost.localdomain) ([109.79.163.135])
 by mail3.vodafone.ie with ESMTP; 14 Nov 2014 14:47:37 +0000
Message-ID: <54661609.9000706@HIDDEN>
Date: Fri, 14 Nov 2014 14:47:37 +0000
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>, aaron brick <abrick@HIDDEN>, 
 19051 <at> debbugs.gnu.org
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
 <5465EA85.7070705@HIDDEN> <5466006C.5000507@HIDDEN>
In-Reply-To: <5466006C.5000507@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 19051
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On 14/11/14 13:15, Eric Blake wrote:
> 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.

Right, that's what I meant. In the original `rm` context above
the directory is (implicitly) referenced.
On all platforms `rm sl/` it will fail.

Following on to the rmdir() issue..
I changed your example below to rmdir which I presume you meant?
Yes solaris leaves the dangling symlink in this case.

> Try this on Solaris:
> 
> $ mkdir a
> $ ln -s a b
> $ rmdir 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).

Thanks for the insight.

So usually a trailing / is treated as the directory itself:

$ mkdir a
$ ln -s a b

$ ls -Fd b/
b//
$ ls -Fd b
b@

$ stat b -c %F
symbolic link
$ stat b/ -c %F
directory

Also in this case coreutils generates that good error internally
without attempting to unlink anything.

$ rm b/
rm: cannot remove ‘b/’: Is a directory

Then we get to the inconsistent Linux behaviour:

$ strace -e unlinkat rm -R b/
unlinkat(AT_FDCWD, "b/", AT_REMOVEDIR)  = -1 ENOTDIR (Not a directory)
rm: cannot remove ‘b/’: Not a directory

$ strace -e rmdir rmdir b/
rmdir("b/")                             = -1 ENOTDIR (Not a directory)
rmdir: failed to remove ‘b/’: Not a directory

I disagree with the inconsistent kernel behavior here,
though agree we shouldn't try to work around it.

thanks,
Pádraig.




Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 14 Nov 2014 14:47:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 09:47:51 2014
Received: from localhost ([127.0.0.1]:60327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpIAB-0007RP-A7
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 09:47:51 -0500
Received: from mx1.redhat.com ([209.132.183.28]:52457)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1XpIA8-0007RD-OI
 for 19051 <at> debbugs.gnu.org; Fri, 14 Nov 2014 09:47:49 -0500
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
 (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAEElijP017481
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Fri, 14 Nov 2014 09:47:45 -0500
Received: from [10.3.113.4] ([10.3.113.4])
 by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 sAEEliFR015165; Fri, 14 Nov 2014 09:47:44 -0500
Message-ID: <54661610.7000105@HIDDEN>
Date: Fri, 14 Nov 2014 07:47:44 -0700
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>,
 aaron brick <abrick@HIDDEN>, 19051 <at> debbugs.gnu.org
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
 <5465EA85.7070705@HIDDEN> <5466006C.5000507@HIDDEN>
In-Reply-To: <5466006C.5000507@HIDDEN>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="EcqJ4x5hreffviUbWOHVOBOXboQa5dWHq"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 19051
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--EcqJ4x5hreffviUbWOHVOBOXboQa5dWHq
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 11/14/2014 06:15 AM, Eric Blake wrote:

>> Confused me too when I encountered it first, but tt's required by POSI=
X:
>> http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.htm=
l#tag_04_11
>=20
> No, actually, POSIX requires that it (attempt to) remove the DIRECTORY,=

> not the symlink.  Linux is intentionally in violation of POSIX on this
> front.
>=20
> Try this on Solaris:
>=20
> $ mkdir a
> $ ln -s a b
> $ rm b/
> $ ls -d ?
> b

Uggh, serves me right for typing without testing.  I'm mixing up
rename(), unlink(), and rmdir() semantics.  Basically,
unlink("anything/") is required by POSIX to fail because the trailing /
means that the only thing to be removed is a directory, but directories
can only be removed by rmdir(), not unlink().

Still, my point remains when you use 'rm -r b/': on Linux, it fails
(cannot remove 'b/': Not a directory), on Solaris it succeeds at
removing 'a' and leaving 'b' dangling.

The fact that Linux intentionally violates POSIX on some of the corner
cases related to symlinks to directories makes it harder to definitively
state what coreutils should do.

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


--EcqJ4x5hreffviUbWOHVOBOXboQa5dWHq
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUZhYQAAoJEKeha0olJ0NqHsIH/1NGxlMmgjC9nnEbQ5odrsoE
+EEM4/VpcL1AC78tI9frRi18LYrVCV21H5rNHGTgdSgVjnOuzywQh42l7lZAFKyt
gt0zHfUBAQOtKcw1sFbR9yqdaDxejxxwul2BGFqigbZCbah6xGqURA+sViIRKkPZ
DiwWyRk/lGnz8KUM0I2+ObgJxFJwjQJSMxUtMPGPCb4Zd48IoEVOk2reTpwHEBJ1
bM+KCKqEICwmhjssFOywpZDooKKs317d6fNSd9psgZzG47PemJk2H5KOp4+mE/hR
RO52835w+4rTmpuRUqOG/vAcpujS1Mvi8t2CA9I+HFvAmsxkduku7S5c8I0z4u4=
=N65K
-----END PGP SIGNATURE-----

--EcqJ4x5hreffviUbWOHVOBOXboQa5dWHq--




Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 14 Nov 2014 13:15:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 08:15:32 2014
Received: from localhost ([127.0.0.1]:60274 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpGiq-0002uf-6L
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 08:15:32 -0500
Received: from mx1.redhat.com ([209.132.183.28]:48917)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1XpGin-0002r6-SG
 for 19051 <at> debbugs.gnu.org; Fri, 14 Nov 2014 08:15:30 -0500
Received: from int-mx09.intmail.prod.int.phx2.redhat.com
 (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAEDFPDI010601
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Fri, 14 Nov 2014 08:15:26 -0500
Received: from [10.3.113.4] ([10.3.113.4])
 by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 sAEDFO4O023397; Fri, 14 Nov 2014 08:15:25 -0500
Message-ID: <5466006C.5000507@HIDDEN>
Date: Fri, 14 Nov 2014 06:15:24 -0700
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>,
 aaron brick <abrick@HIDDEN>, 19051 <at> debbugs.gnu.org
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
 <5465EA85.7070705@HIDDEN>
In-Reply-To: <5465EA85.7070705@HIDDEN>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="F8HLMTTNWrBOAdDrtuoPAr95GJCXC7095"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 19051
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--F8HLMTTNWrBOAdDrtuoPAr95GJCXC7095
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 11/14/2014 04:41 AM, P=C3=A1draig Brady wrote:
> tag 19051 notabug
> close 19501
> stop
>=20
> 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
>> $
>>

>=20
> 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

>=20
> 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).

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


--F8HLMTTNWrBOAdDrtuoPAr95GJCXC7095
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUZgBsAAoJEKeha0olJ0NqhH0H/RX4T+lneNtjveXRg3imRSJ6
joHt5884tKfNQKPnDUY35ibDVM83Hho7+B40vw2IzTpM/HlzDElI3VDK61Q06zc5
MDH9exEUv65ZQsBGu+d43z2N/ywbUUvArRllgR3BYPkCRE5S9ZzQblSZFGBoG7IW
CSd6D1YLqEowmEeA3sJCExFVDi1pUNLgRsFIzrSi7XR/38UulTwR2rou6Zq51rIT
0H2MrdWbv8BSJJxm/JBtESd2kCoL8uKjrcKR/r83sZ61/8cgCuFXomtwLTD2Kwlt
LzfzmYvN8811KkerRKzVIoMS8QFBHo7f1U8CIFq0OXm96F5Re3enmLhx3nGbRjs=
=bIsJ
-----END PGP SIGNATURE-----

--F8HLMTTNWrBOAdDrtuoPAr95GJCXC7095--




Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at 19051 <at> debbugs.gnu.org:


Received: (at 19051) by debbugs.gnu.org; 14 Nov 2014 11:42:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 06:42:22 2014
Received: from localhost ([127.0.0.1]:60241 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpFGg-00073z-HJ
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 06:42:22 -0500
Received: from mail3.vodafone.ie ([213.233.128.45]:36646)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <P@HIDDEN>) id 1XpFGd-00073p-M1
 for 19051 <at> debbugs.gnu.org; Fri, 14 Nov 2014 06:42:20 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AjULAFXqZVRtT6OH/2dsb2JhbABbDoMAVVkBgSKBE1DKAIZ3UgECAoEiFgEBAQEBfYQDAQEEIw8BVgsNCwICBRYLAgIJAwIBAgFFBgEMCAEBiEEBCLpDhg2QNQwggS2PfIJ3gVQFlyKIXj2GO4pEhAqDPEA9MAGCSgEBAQ
Received: from unknown (HELO localhost.localdomain) ([109.79.163.135])
 by mail3.vodafone.ie with ESMTP; 14 Nov 2014 11:41:57 +0000
Message-ID: <5465EA85.7070705@HIDDEN>
Date: Fri, 14 Nov 2014 11:41:57 +0000
From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= <P@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: aaron brick <abrick@HIDDEN>, 19051 <at> debbugs.gnu.org
Subject: Re: bug#19051: rm symboliclink/ # "Is a directory"
References: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
In-Reply-To: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 19051
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

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
> $
> 
> the presence of the slash is not such a great way to test for whether
> or not a file is a directory. you may find the above example
> contrived, but it occurs easily because bash's default tab completion
> for symlinks to directories adds the trailing slash. this confused the
> hell out of one of my students.
> 
> thanks for your hard work!
> aaron brick.

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

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.

thanks,

Pádraig.






Information forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Nov 2014 07:19:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 14 02:19:08 2014
Received: from localhost ([127.0.0.1]:60062 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XpB9w-0007Oz-9Y
	for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 02:19:08 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59114)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bricktron@HIDDEN>) id 1XpAlB-0006kQ-AU
 for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 01:53:34 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bricktron@HIDDEN>) id 1XpAlA-0002rR-78
 for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 01:53:32 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:60832)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bricktron@HIDDEN>) id 1XpAlA-0002rN-3r
 for submit <at> debbugs.gnu.org; Fri, 14 Nov 2014 01:53:32 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:60836)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bricktron@HIDDEN>) id 1XpAl9-0006xi-Ai
 for bug-coreutils@HIDDEN; Fri, 14 Nov 2014 01:53:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bricktron@HIDDEN>) id 1XpAl8-0002rD-Ir
 for bug-coreutils@HIDDEN; Fri, 14 Nov 2014 01:53:31 -0500
Received: from mail-ig0-x22f.google.com ([2607:f8b0:4001:c05::22f]:49072)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bricktron@HIDDEN>) id 1XpAl8-0002r7-ET
 for bug-coreutils@HIDDEN; Fri, 14 Nov 2014 01:53:30 -0500
Received: by mail-ig0-f175.google.com with SMTP id h15so1016848igd.14
 for <bug-coreutils@HIDDEN>; Thu, 13 Nov 2014 22:53:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:from:date:message-id:subject:to:content-type;
 bh=LrVeHAJrMEZL2bk+jSVA2iZbPZPNjizOgIl2TTOSiNM=;
 b=TlMf0yzrGOXueHMSgbshwvU3E2vT5yG6bwkGMConQOqUithSJO45Le8AK1S4Ym+ZG7
 cUPaZgyRWD3s/KP5zaKZS85dLi5c3bs8aKvpdphB35QxCJsfIBBiARlnoD9K+RGRtzX2
 6Xe6vf8rfqf6pwvwiQO9rHgTF8Nt9MrbYRE/T5N0l1+watb8W+kLUAYWqKB4ecvwT5Jc
 Zfl0gKl5+LCH9KI5cj3KyrwhLfpwVeeX9LJsDM9d6bYhG96WlcUiutlkC4AWN7s52M9+
 uKNjxF3OwZX8QO6GDgXXijGEpmKVZedFkL+JEKJbYKt74RKodqhCsI2BhwLBMOC7CPxB
 pWKQ==
X-Received: by 10.50.110.65 with SMTP id hy1mr4029377igb.13.1415948009385;
 Thu, 13 Nov 2014 22:53:29 -0800 (PST)
MIME-Version: 1.0
Received: by 10.50.100.163 with HTTP; Thu, 13 Nov 2014 22:53:09 -0800 (PST)
From: aaron brick <abrick@HIDDEN>
Date: Thu, 13 Nov 2014 22:53:09 -0800
X-Google-Sender-Auth: 3DKzgZVcoGIf56LLvM4KwDIQpPI
Message-ID: <CANfomjK4CQbgadvt_akNzwzcv5apnb41vgq8CgcCuM+QNY-Uag@HIDDEN>
Subject: rm symboliclink/ # "Is a directory"
To: bug-coreutils@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 14 Nov 2014 02:19:06 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

hi folks,

$ ln -s / sl
$ rm sl/
rm: cannot remove `sl/': Is a directory
$ rm sl
$

the presence of the slash is not such a great way to test for whether
or not a file is a directory. you may find the above example
contrived, but it occurs easily because bash's default tab completion
for symlinks to directories adds the trailing slash. this confused the
hell out of one of my students.

thanks for your hard work!
aaron brick.




Acknowledgement sent to aaron brick <abrick@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#19051; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.