GNU bug report logs -
#43162
chgrp clears setgid even when group is not changed
Previous Next
Reported by: Karl Berry <karl <at> freefriends.org>
Date: Tue, 1 Sep 2020 21:26:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 43162 <at> debbugs.gnu.org (full text, mbox):
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.
This bug report was last modified 4 years and 337 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.