GNU bug report logs -
#8729
RFE: chmod "-D" operate on dir's only
Previous Next
Reported by: Linda Walsh <coreutils <at> tlinx.org>
Date: Wed, 25 May 2011 01:58:01 UTC
Severity: normal
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 8729 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 05/24/2011 07:57 PM, Linda Walsh wrote:
> I know one can (and I usually do) construct a find command to do
> this, but it's something I do so often, and it's a natural 'pair'
> for what is often done with chmod.
>
> If I want to make sure a dir tree is readable/accessable
> by a group or other, I usually do:
>
> chmod -R g+r,o+r .
> find . -type d -print0|xargs -0 chmod g+x,o+x
>
> What'd be a great addition to chmod is for it to have an option
> for chmod to only work on dirs. (is -D taken?)
>
> So instead of the 2nd line above:
>
> chmod -DR g+x,o+x
>
> ----
> What'cha think?
I think that you are better off using what POSIX has already
standardized for chmod:
chmod -R go+rX .
which says for all files in the hierarchy, add read bits for group and
others to files and directories, and add execute bits only for files and
directories that were already executable by the user. Thus
non-executable files (since your directories likely already have the u+x
permission, since a non-searchable directory is rare) are not granted
execute permissions, while directories are nicely handled without
needing a followup find|xargs.
>
> Is that a useful and logical addition for chmod?
It's not a very strong case, and certainly not strong enough to burn a
short option letter for. But if you want to pursue the idea, a patch
with a long option name (instead of short option), documentation, and
test cases, as well as rationale why relying on already standardized
tools is inefficient, may sway my mind.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 14 years and 58 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.