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: Wed, 20 Nov 2013 06:44:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/19/2013 11:45 PM, Bernhard Voelker wrote:
> On 11/20/2013 03:19 AM, Eric Blake wrote:
>> 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(".").
> 
> I disagree: see at the top of:
> 
>   http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html
> 
>   If either of the files dot or dot-dot are specified as the basename
>   portion of an operand (that is, the final pathname component) or if
>   an operand resolves to the root directory, rm shall write a diagnostic
>   message to standard error and do nothing more with such operands.

Ah, that's where it is.  I was looking in the numbered steps, not the
paragraph before the numbered steps.  So it appears that coreutils is
compliant after all.

> 
> Maybe "cannot remove directory" is a bit weak - it's more like
> "refusing to remove dot|dot-dot|root directory".

Indeed, a clearer error message would be possible.

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