chmod no longer clears sticky bit

2006-09-30 Thread Mike Frysinger
looks like doing `chmod 0755` no longer clears sticky bits ... for example:
$ tar xf coreutils-6.3.tar.bz2
$ cd coreutils-6.3
$ ./configure
$ make -C lib
$ make -C src chmod
$ mkdir foo
$ stat -c%a foo
755
$ ./src/chmod -v 2755 foo
mode of `foo' changed to 2755 (rwxr-sr-x)
$ stat -c%a foo
2755
$ ./src/chmod -v 0755 foo
mode of `foo' retained as 2755 (rwxr-sr-x)
$ stat -c%a foo
2755

erm ?
-mike


pgphyYGAcoYYG.pgp
Description: PGP signature
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: chmod no longer clears sticky bit

2006-09-30 Thread Mike Frysinger
On Saturday 30 September 2006 19:07, Mike Frysinger wrote:
 looks like doing `chmod 0755` no longer clears sticky bits ...

seems to arise from lib/modechange.c:mode_adjust() ... particularly:
mode_t omit_change =
(dir ? S_ISUID | S_ISGID : 0)  ~ changes-mentioned;

omit_change here is set to 06000 ... so when that is inverted and masked 
against the requested 02755, the requested changes become simply 00755 ...
-mike


pgphpA5OV0vCG.pgp
Description: PGP signature
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: chmod no longer clears sticky bit

2006-09-30 Thread Paul Eggert
Mike Frysinger [EMAIL PROTECTED] writes:

 looks like doing `chmod 0755` no longer clears sticky bits ... for example:

Yes, that's mentioned in the NEWS file.  It says:

  chmod, install, and mkdir now preserve a directory's set-user-ID and
  set-group-ID bits unless you explicitly request otherwise.  E.g.,
  `chmod 755 DIR' and `chmod u=rwx,go=rx DIR' now preserve DIR's
  set-user-ID and set-group-ID bits instead of clearing them, and
  similarly for `mkdir -m 755 DIR' and `mkdir -m u=rwx,go=rx DIR'.  To
  clear the bits, mention them explicitly in a symbolic mode, e.g.,
  `mkdir -m u=rwx,go=rx,-s DIR'.  To set them, mention them explicitly
  in either a symbolic or a numeric mode, e.g., `mkdir -m 2755 DIR',
  `mkdir -m u=rwx,go=rx,g+s' DIR.  This change is for convenience on
  systems where these bits inherit from parents.  Unfortunately other
  operating systems are not consistent here, and portable scripts
  cannot assume the bits are set, cleared, or preserved, even when the
  bits are explicitly mentioned.  For example, OpenBSD 3.9 `mkdir -m
  777 D' preserves D's setgid bit but `chmod 777 D' clears it.
  Conversely, Solaris 10 `mkdir -m 777 D', `mkdir -m g-s D', and
  `chmod 0777 D' all preserve D's setgid bit, and you must use
  something like `chmod g-s D' to clear it.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: chmod no longer clears sticky bit

2006-09-30 Thread Paul Eggert
Mike Frysinger [EMAIL PROTECTED] writes:

 i guess this is allowed by spec huh ?

Yes.  The last sentence in the extract that you quoted clearly allows
the current behavior.  The area is not standardized that closely, so
we tried to do the right thing.  It was discussed in several threads,
e.g.,
http://lists.gnu.org/archive/html/bug-coreutils/2006-07/msg00124.html.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils