bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

chmod 0755 behaves like chmod 755


From: Jason Pepas
Subject: chmod 0755 behaves like chmod 755
Date: Tue, 02 Oct 2007 14:31:50 -0500
User-agent: Thunderbird 2.0.0.0 (X11/20070420)

I think I might have found a bug regarding the new behavior of chmod (regarding the preservation of setuig, setgid, etc) in coreutils-6.9.

My understanding is that the new behavior should preserve these bits if they are not explicitly specified, and this appears to work correctly:

$ mkdir foo
$ ls -ld foo
drwxr-xr-x 2 cell dept 4096 Oct  2 13:46 foo
$ chmod g+s foo
$ ls -ld foo
drwxr-sr-x 2 cell dept 4096 Oct  2 13:46 foo
$ chmod 755 foo
$ ls -ld foo
drwxr-sr-x 2 cell dept 4096 Oct  2 13:46 foo

However, the problem exists for the case where a user *does* explicitly specify what those bits should be. chmod respects those bits while setting them:

$ mkdir foo
$ ls -ld foo
drwxr-xr-x 2 cell dept 4096 Oct  2 13:40 foo
$ chmod 2755 foo
$ ls -ld foo
drwxr-sr-x 2 cell dept 4096 Oct  2 13:40 foo

but ignores them when the user attempts to clear them:

$ chmod 0755 foo
$ ls -ld foo
drwxr-sr-x 2 cell dept 4096 Oct  2 13:40 foo

However, using the symbolic instead of octal notation works correctly:

$ chmod g-s foo
$ ls -ld foo
drwxr-xr-x 2 cell dept 4096 Oct  2 13:40 foo

Is there any way to clear the setgid bit using octal notation?

-jason




reply via email to

[Prev in Thread] Current Thread [Next in Thread]