Evan Hunt <[EMAIL PROTECTED]> writes: > the principle of least surprise calls for chmod to behave the > same way with both files and directories.
That's true, but there are other principles involved, namely convenience and compatibility. There's some old history involved, so bear with me. Many old scripts (and new scripts written by traditionalist programmers) use commands like "chmod 755" that worked just fine in Unix Version 7 (where newly created files get the group of the owner), as well as in 4.2BSD (where they get the group of the parent directory), because in those operating systems the setgid bits of directories didn't matter. However, the naive implementation of "chmod 755" had undesirable effects in SunOS 4.x (late 1980s), an operating system that used the setgid bit to switch between V7 and 4.2BSD semantics. That is because "chmod 755" cleared the setgid bit on directories, which messes up permissions of files that are later created in that directory, and makes files harder to share. So in SunOS 4.x Sun changed "chmod 755 dir" to leave the setgid bit alone. The GNU project prefers to make sharing convenient, so we followed Sun's lead. Secondarily, it is more convenient for GNU to be compatible with SunOS than to be incompatible with it, as SunOS is the most-popular Unix implementation. _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
