bug-coreutils
[Top][All Lists]
Advanced

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

Re: [bug #25848] chmod fails to clear sgid bit on absolute changes


From: Jim Meyering
Subject: Re: [bug #25848] chmod fails to clear sgid bit on absolute changes
Date: Mon, 16 Mar 2009 06:34:44 +0100

Detlev Zundel wrote:
>> Thanks for the report, but that is the documented behavior:
>>
>>   info coreutils 'file perm' dir
>
> Ah, oh.  I didn't know this.  This actually violates the principle of
> least surprise in my eyes, but hey, if it is documented, I am ok with
> it.
>
> Thinking some more about it, isn't the behaviour then wrong by clearing
> the set-uid bit?
>
> The doc says:
>
>      If you want to try to clear these bits, you must mention them
>   explicitly in a symbolic mode, e.g.:
>
> But if I review my example, then I first set suid+sgid, then do a chmod
> 0 and suid is still set, but not suid:
>
> address@hidden:tmp[0]$ mkdir foo ; $p/chmod 3777 foo ; ls -ld foo ; $p/chmod 
> 0 foo ; ls -ld foo
> drwxrwsrwt 2 dzu dzu 4096 2009-03-13 15:28 foo
> d-----S--- 2 dzu dzu 4096 2009-03-13 15:28 foo
>
> Isn't this still a bug alas the other way round then I originally
> thought?

I don't think so.
The documentation doesn't say that is the only way to clear those bits.
The chmod system call itself may clear them, too, but that is system-
dependent.




reply via email to

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