bug-coreutils
[Top][All Lists]
Advanced

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

bug#15926: RFE: unlink command already uses 'unlink' call; make 'rm' use


From: Eric Blake
Subject: bug#15926: RFE: unlink command already uses 'unlink' call; make 'rm' use 'remove' call
Date: Tue, 19 Nov 2013 19:19:27 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/19/2013 01:45 PM, Bob Proulx wrote:

>> Posix changed that requiring special checks for ".".  Scripts relied
>> on that behavior for 30-40 years as well...  If you want to use that
>> reasoning, rm should go back to doing depth first deletion and
>> reporting an error with deleting "." when it is finished.
> 

I see nothing in
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html that
requires up-front special handling of trailing '.', only a callout to
what rmdir() is required to do.  Ultimately, rmdir("dir/.") is required
to fail, but nothing in POSIX appears to allow us to short-circuit the
recursive cleanup before attempting the failing command.

> I actually agree with you on that point. ;-)
> (Regarding 'rm -rf .')

Yes, the 'rm -rf .' case appears to be a regression in coreutils that is
contrary to the behavior required by POSIX.  That is:

$ mkdir /tmp/foo /tmp/foo/sub
$ cd /tmp/foo
$ rm -r .
rm: cannot remove directory: ‘.’
$ ls
sub

appears to be a bug in current coreutils, because it should have
successfully called rmdir("sub") prior to failing on the attempt to
rmdir(".").

-- 
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]