Subject: Re: bug#8391: chmod setuid & setguid bits

From: Eric Blake <[email-masked]>
Date: Thu, 31 Mar 2011 15:07:03 -0600

On 03/31/2011 02:15 PM, Eric Blake wrote:
> I also don't know how many of the implementations are technically right
> - POSIX allows a wide range of acceptable behavior, but did require that
> the particular behavior used be documented (not like anyone wants to
> read documentation for multiple implementations to compare them to see
> where things will go different).  But if other implementations don't
> document what they do, then they are wrong no matter how you look at it,
> even if they can justify their behavior under a typical work flow.

Also note that there is a difference between POSIX requirements:

chmod 755 file - must clear setgid bit
chmod 2755 file - must set setgid bit
chmod 755 dir - may leave setgid bit set
chmod 2755 dir - may leave setgid bit clear

because POSIX is explicit that regular files treat the octal argument
literally for all 12 bits, but that all other file types are
implementation-defined on the effect on the top 3 bits.

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org