[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rm should exit immediately if the user cannot write to the parent direct
From: |
Alex Henrie |
Subject: |
rm should exit immediately if the user cannot write to the parent directory |
Date: |
Thu, 3 Sep 2015 08:56:42 -0600 |
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.
-Alex
- rm should exit immediately if the user cannot write to the parent directory,
Alex Henrie <=