bug-coreutils
[Top][All Lists]
Advanced

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

bug#8729: RFE: chmod "-D" operate on dir's only


From: Eric Blake
Subject: bug#8729: RFE: chmod "-D" operate on dir's only
Date: Wed, 25 May 2011 07:54:08 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

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   address@hidden    +1-801-349-2682
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]