bug-coreutils
[Top][All Lists]
Advanced

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

bug#43162: chgrp clears setgid even when group is not changed


From: Paul Eggert
Subject: bug#43162: chgrp clears setgid even when group is not changed
Date: Tue, 1 Sep 2020 15:24:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 9/1/20 2:25 PM, Karl Berry wrote:
Is it necessary for chgrp to clear setgid on directories even when the
group is not actually changed? In my life at least, it is rather
annoying.

The chgrp command isn't doing that directly; it's merely invoking the fchownat syscall, and the syscall is clearing setgid.

POSIX requires chgrp to behave like the chown syscall even if the file's group is already correct, and it appears that the syscall clears the setgid bit on your platform (a behavior that POSIX allows, and even requires for regular files). So partly this is a platform issue (I don't observe your problem on my Fedora 31 box, for example).

I don't see an easy way to change chgrp without departing from POSIX, or perhaps adding a run-time option to the chown and chgrp commands. Not sure it's worth it.





reply via email to

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