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

Previous Next

Package: coreutils;

Reported by: Enrico Scholz <enrico.scholz <at> informatik.tu-chemnitz.de>

Date: Sat, 6 Apr 2013 16:14:02 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: Bob Proulx <bob <at> proulx.com>
Cc: Enrico Scholz <enrico.scholz <at> informatik.tu-chemnitz.de>, 14152 <at> debbugs.gnu.org
Subject: bug#14152: [PATCH] build: use 'chmod a-w' instead of 'chmod -w'
Date: Mon, 08 Apr 2013 08:09:05 -0600
[Message part 1 (text/plain, inline)]
On 04/06/2013 04:27 PM, Bob Proulx wrote:
> Pádraig Brady wrote:
>>> -	  && chmod -w $@-t						\
>>> +	  && chmod a-w $@-t						\
>>
>> 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

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 12 years and 51 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.