Subject: Re: chmod(1) and '+X'
To: None <perry@piermont.com>
From: Ben Harris <bjh21@netbsd.org>
List: tech-userlevel
Date: 01/17/2004 22:29:26
In article <87d69i2zm9.fsf@snark.piermont.com> you write:
>Jan Schaumann <jschauma@netbsd.org> writes:
>> "Perry E. Metzger" <perry@piermont.com> wrote:
>>  
>>> So far as I know, our chmod ALREADY behaves correctly.
>>
>> So the behaviour I reported in
>> http://mail-index.netbsd.org/tech-userlevel/2003/12/13/0008.html is
>> correct?  It seems to me that 'chmod o-X' should remove the executable
>> bit from all directories or files that have it set.  Instead, atm, it
>> _sets_ the executable bit, as if 'chmd o+X' had been issued.
>
>Didn't know about that.  What I meant was that chmod o=rX works just
>fine -- + isn't the only thing that works right.
>Certainly adding the bit is wrong in the - case.
>
>However, what it *should* do is also unclear. What do other chmod's
>do? the -X thing seems ambiguous with respect to files at least.

As far as I can see POSIX is quite clear.  X means the same thing whatever
the operation, so -X means "remove execute if the file is a directory or any
execute bit is currently set", which makes it equivalent to -x.

-- 
Ben Harris                                                   <bjh21@NetBSD.org>
Portmaster, NetBSD/acorn26           <URL:http://www.NetBSD.org/Ports/acorn26/>