bug-coreutils
[Top][All Lists]
Advanced

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

bug#14152: [PATCH] build: use 'chmod a-w' instead of 'chmod -w'


From: Eric Blake
Subject: bug#14152: [PATCH] build: use 'chmod a-w' instead of 'chmod -w'
Date: Mon, 08 Apr 2013 08:09:05 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5

On 04/06/2013 04:27 PM, Bob Proulx wrote:
> Pádraig Brady wrote:
>>> -     && chmod -w address@hidden                                            
>>> \
>>> +     && chmod a-w address@hidden                                           
>>> \
>>
>> I'll apply that fix.
> 
> I think it is always a good idea to use 'a' when there isn't any other
> specific reason to do anything different.  Or put the reverse way,
> whenever I see a naken "-[rwx]" then I am suspicious of the action.
> Because it masks with umask and is almost never what is desired.

Actually, POSIX says that:

chmod -w foo

is undefined (that is, an argument with a leading - is interpreted as an
option rather than as a mode string, but chmod is NOT required to
support a -w option, even though many implementations support it as an
extension).  Meanwhile, POSIX requires that

chmod -- -w foo

is required to mask with umask.  In fact, in coreutils, we exploit the
fact that chmod -[rwx] is undefined, in order to emit warnings if the
resulting change did not disable all bits.  Using a-w instead of the
undefined '-w' or the well-defined but confusing '-- -w' is indeed the
right way to fix things.

-- 
Eric Blake   eblake redhat com    +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]