bug-coreutils
[Top][All Lists]
Advanced

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

bug#8391: chmod setuid & setguid bits


From: Eric Blake
Subject: bug#8391: chmod setuid & setguid bits
Date: Fri, 24 Feb 2012 12:48:49 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1

On 02/24/2012 12:33 PM, Ondrej Vasik wrote:
>> Sorry, I don't follow.  If I have a decimal mode 'mode' in a script,
>> then this:
>>
>>   chmod @$(printf %o $mode) DIR
>>
>> is easier and simpler than this:
>>
>>   chmod $(printf %5.5o $mode) DIR
>>
>> The "5.5o" is tricky: Why *two* "5"s?

By that argument, this is also equally simple:

chmod 0000$(printf %o $mode) DIR

>> and who can remember which "5" is really needed, and why,
>> right off the bat? and remember why "5", and not "4" or "6"?
>>
>> The "@" is simple.

s/@/0000/, and you have your distro-agnostic prefix.

> 
> Yes, but `chmod @755 DIR' approach will not let you to write a script
> which will work without modification on RHEL-4,RHEL-5 and RHEL-6
> machine... which is not the case with fully octal mode. That's what I'm
> trying to say with "you still have octal digit". This %5.5o was more
> about "easy" change to their script which will allow them to use one
> script on everything again...
> This kind of approach (one script for more systems) is very common in
> enterprise area - and without possibility of doing that, requester will
> not be fine with the solution.

And it's arguments like that why I still think multiple leading zeros is
better than any other prefix.

-- 
Eric Blake   address@hidden    +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]