coreutils
[Top][All Lists]
Advanced

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

Re: rm should exit immediately if the user cannot write to the parent di


From: Pádraig Brady
Subject: Re: rm should exit immediately if the user cannot write to the parent directory
Date: Thu, 03 Sep 2015 16:56:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 03/09/15 15:56, Alex Henrie wrote:
> Hi,
> 
> I have run into an annoying problem with GNU rm. When I try to remove
> a file to which I do not have write permission from a directory to
> which I do not have write permission, rm warns me about the file being
> read-only before telling me that I do not actually have permission to
> delete it:
> 
> $ sudo mkdir foo
> $ sudo touch foo/bar
> $ rm foo/bar
> rm: remove write-protected regular empty file 'foo/bar'? yes
> rm: cannot remove 'foo/bar': Permission denied
> 
> It looks like rm could use dirname and faccessat to check for write
> permission on the parent directory before showing a prompt. Would you
> be willing to add a preliminary check like this to rm to avoid useless
> prompts? To clarify, what I want to see is:
> 
> $ sudo mkdir foo
> $ sudo touch foo/bar
> $ rm foo/bar
> rm: cannot remove 'foo/bar': Permission denied
> 
> Of course, if I have write permission to the directory but not the
> file, I would still expect to see a warning about deleting a read-only
> file (unless -f is given).
> 
> Please let me know if this is a feasible change.

I see your point.  It's similar to the prompting discussed in
http://bugs.gnu.org/16669

The most general behavior is the current one,
where the operations are independent, allowing
in this example for the dir to be `chmod +w` while
the prompt is displayed.  Now that would be unusual.
I need to think more about it.

thanks,
Pádraig.



reply via email to

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