Bug 244422

Summary: regression: chmod setuid/setgid doesn't do what it's told
Product: [Fedora] Fedora Reporter: Zing <zing>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 7CC: meyering, stephenbryant
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-18 06:41:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zing 2007-06-15 15:39:03 UTC
Description of problem:
chmod is not removing setuid/setgid bit using OCTAL-MODE.

Version-Release number of selected component (if applicable):
coreutils-6.9-2.fc7.x86_64

How reproducible:
always

Steps to Reproduce:

1. I want to make a directory setgid:

# ls -ld .
drwxrwx--- 3 root svn 4096 2007-06-15 10:59 ./
# chmod 4770 .
# ls -ld .
drwsrwx--- 3 root svn 4096 2007-06-15 10:59 ./

2. oops, not setuid... fix that...

# chmod 2770 .
# ls -ld .
drwsrws--- 3 root svn 4096 2007-06-15 10:59 ./

3. WTF!@#$!  I said 2770!!!!! NOT 6770

4. <calm down> try to clear the bits...

# chmod 0770 .
# ls -ld .
drwsrws--- 3 root svn 4096 2007-06-15 10:59 ./

5. kill -9 self

Actual results:
something dumb

Expected results:
i expect 2770 to be 2770.  There doesn't even seem to be a way to clear the
setuid/setgid bits?

Additional Info:
What in the world is the use case for this bizarre semantics???  You've changed
how this utility has worked for a long time... Please revert/fix to get back
normalcy in this world.

Comment 1 Jim Meyering 2007-06-18 06:41:12 UTC
This is a duplicate of http://bugzilla.redhat.com/243517
Now you have to use chmod's symbolic modes (u-s, g-s, o-t) to clear a
directory's special bits.

*** This bug has been marked as a duplicate of 243517 ***

Comment 2 Steve Bryant 2007-06-18 08:14:26 UTC
N.B. both "chmod 777" and "chmod 0777" do turn off the sticky bit, but not the
set-uid and set-gid bits of directories.