Subject: Re: chmod(1) and '+X'
To: None <>
From: Ben Harris <>
List: tech-userlevel
Date: 01/13/2004 18:07:57
[ This has been on my "really must reply to this" pile for weeks.  Sorry. ]

In article <> you write:
>I just come across this discrepancy between the manual page and real
>chmod(1)'s manual page states:
>	The perm symbols represent the portions of the mode bits as
>	follows:
>	X	The execute/search bits if the file is a
>		directory or any of the execute/search bits are set
>		in the original (unmodified) mode.  Operations with
>		the perm symbol ``X'' are only meaningful in conjun-
>		ction with the op symbol ``+'', and are ignored in
>		all other cases.
>So, it seems that 'X' is not ignored, but instead the op symbol is
>ignored if 'X' is specified and chmod(1) behaves as if '+' had been
>given as the op symbol.
>GNU chmod(1) doesn't say that 'X' is ignored unless the operator is '+',
>and behaves as you would expect.  Irix' chmod man pages says that it
>does ignore 'X' unless '+' is specified, but behaves as the GNU chmod.
>So... should our chmod be changed to behave as GNU chmod?

I think so, yes.  POSIX says:

# The perm symbol X shall represent the execute/search portion of the file
# mode bits if the file is a directory or if the current (unmodified) file
# mode bits have at least one of the execute bits (S_IXUSR, S_IXGRP, or
# S_IXOTH) set. It shall be ignored if the file is not a directory and none
# of the execute bits are set in the current file mode bits.

That matches the first sentence of our documentation -- the second sentence
is wrong and should be deleted, and chmod should then be made to do what the
documentation says.

Ben Harris                                                   <>
Portmaster, NetBSD/acorn26           <URL:>