#642758 [coreutils] chmod manual page wrong about effect on directories special bits when OCTAL-MODE is given

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Filipus Klutiero
Date:
2011-09-25 03:57:15 UTC
Severity:
normal
#642758#5
Date:
2011-09-24 21:51:45 UTC
From:
To:
chmod's manual page contains:

An octal number does not necessarily represent the bit pattern for the
new mode bits. If a FILE is a directory, the first digit does not
necessarily represent the bit pattern of its special bits. As explained
in the "SETUID AND SETGID BITS" section:

Therefore, for example, if a directory has mode 2775, running chmod on
it with OCTAL-MODE 0775 does not change its mode [to 0775].

#642758#10
Date:
2011-09-24 22:40:33 UTC
From:
To:
Filipus Klutiero wrote:

The change to the way octal file modes are handled is a recent one to
the upstream coreutils.  (One that I argued against making as it
happens.)  It was implemented to make shared work among several users
easier.  It intentionally requires clearing the sgid bit with an
explicit command so that the sgid bit remains behind in the typical
usage.  If people are working with an sgid directory then most of the
time the commands do the right thing.  And if you use the symbolic
modes which are preferred now then there isn't an issue.  I always use
the symbolic modes now.

But being a recent feature addition to the upstream coreutils the
ramifications haven't filtered through everywhere yet.  It will take a
while for all of the parts such as documentation to be corrected.

Do you have a suggestion for how this wording may be improved?

Bob

#642758#15
Date:
2011-09-25 00:30:59 UTC
From:
To:
Le 2011-09-24 18:40, Bob Proulx a écrit :
Interesting...

Not particularly. I wasn't aware of this change before today, and I
spent a couple of hours trying to understand modes and chmod. What is
clear is that unless you opt for vagueness, the description has to
become more complex. I think there could be a general description, then
a subsection for each usage. To avoid confusion, it would help to rename
MODE to something that distinguishes from OCTAL-MODE, perhaps
SYMBOLIC-MODE-CHANGE. OCTAL-MODE could also become OCTAL-MODE-CHANGE to
be exact. Then the subsection on the octal mode would need to
distinguish the first digit from the others.

#642758#20
Date:
2011-09-25 03:32:32 UTC
From:
To:
Filipus Klutiero wrote:

Here is one of the earlier threads of discussion concerning it.

http://lists.gnu.org/archive/html/bug-coreutils/2006-07/msg00124.html

Bob