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].
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
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.
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