[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
chmod octal form of sgid/suid removal fails
From: |
Jan Engelhardt |
Subject: |
chmod octal form of sgid/suid removal fails |
Date: |
Sat, 12 May 2007 16:50:00 +0200 (MEST) |
Cc'ed bug-coreutils.
The following bug affects at least:
coreutils 6.4 (used in opensuse 10.2 - open a bug report here)
coreutils 6.9
On May 12 2007 15:16, J G Miller wrote:
>From: J G Miller
>To: Jan Engelhardt
>Subject: re: chmod octal form of sgid/suid removal fails
>
>[...]
Ah yes you are right.
$ mkdir /dev/shm/me
$ strace -e chmod chmod 0755 me
chmod("me", 02755) = 0
This seems to be a bug in mode_compile() which does not
care about leading zeros, CONTRATY to what the manpage says:
A numeric mode is from one to four octal digits (0-7), derived by
adding up the bits with values 4, 2, and 1. Omitted digits are assumed
to be leading zeros, except that if the first digit is omitted, a
directory's set user and group ID bits are not affected.
and at the same time, the mode_adjust() function just goes
by "directory or not" (line 323) and does not really care
about the leading zero either.
323 mode_t omit_change =
324 (dir ? S_ISUID | S_ISGID : 0) & ~ changes->mentioned;
which is always 06000 for directories - which should not be.
Jan
--