GNU bug report logs - #43162
chgrp clears setgid even when group is not changed

Previous Next

Package: coreutils;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43162 in the body.
You can then email your comments to 43162 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#43162; Package coreutils. (Tue, 01 Sep 2020 21:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Karl Berry <karl <at> freefriends.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 01 Sep 2020 21:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: bug-coreutils <at> gnu.org
Subject: chgrp clears setgid even when group is not changed
Date: Tue, 1 Sep 2020 15:25:45 -0600
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. --thanks, karl.

$ mkdir foo
$ chmod g+s foo
$ ls -ld foo
drwxrwsr-x 2 karl root 6 Sep  1 10:36 foo/
$ chgrp root foo
$ ls -ld foo
drwxrwxr-x 2 karl root 6 Sep  1 10:36 foo/




Information forwarded to bug-coreutils <at> gnu.org:
bug#43162; Package coreutils. (Tue, 01 Sep 2020 22:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 43162 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Karl Berry <karl <at> freefriends.org>
Cc: 43162 <at> debbugs.gnu.org
Subject: Re: bug#43162: chgrp clears setgid even when group is not changed
Date: Tue, 1 Sep 2020 15:24:18 -0700
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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#43162; Package coreutils. (Tue, 01 Sep 2020 22:32:01 GMT) Full text and rfc822 format available.

Message #11 received at 43162 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: eggert <at> cs.ucla.edu
Cc: 43162 <at> debbugs.gnu.org
Subject: Re: bug#43162: chgrp clears setgid even when group is not changed
Date: Tue, 1 Sep 2020 16:30:53 -0600
    So partly this is a platform issue 

I was on centos7.

    (I don't observe your problem on my Fedora 31 box, for example).

Maybe there is hope for a future centos, then.

    adding a run-time option to the chown and chgrp commands. Not sure
    it's worth it.

Agreed about not being worth it. Oh well. --thanks, karl.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 02 Sep 2020 02:10:02 GMT) Full text and rfc822 format available.

Notification sent to Karl Berry <karl <at> freefriends.org>:
bug acknowledged by developer. (Wed, 02 Sep 2020 02:10:02 GMT) Full text and rfc822 format available.

Message #16 received at 43162-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Karl Berry <karl <at> freefriends.org>
Cc: 43162-done <at> debbugs.gnu.org
Subject: Re: bug#43162: chgrp clears setgid even when group is not changed
Date: Tue, 1 Sep 2020 19:09:23 -0700
On 9/1/20 3:30 PM, Karl Berry wrote:
> I was on centos7.
> 
>      (I don't observe your problem on my Fedora 31 box, for example).
> 
> Maybe there is hope for a future centos, then.

Maybe. Or it could be a filesystem or mounting issue. My filesystem was ext4 
mounted rw,relatime,seclabel, for what it's worth.

Anyway, closing the bug report.




Information forwarded to bug-coreutils <at> gnu.org:
bug#43162; Package coreutils. (Sun, 20 Sep 2020 23:08:02 GMT) Full text and rfc822 format available.

Message #19 received at 43162 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: 43162 <at> debbugs.gnu.org, karl <at> freefriends.org
Subject: Re: bug#43162: chgrp clears setgid even when group is not changed
Date: Sun, 20 Sep 2020 17:07:03 -0600
Paul Eggert wrote:
> Karl Berry wrote:
> > I was on centos7.
> > 
> >      (I don't observe your problem on my Fedora 31 box, for example).
> > 
> > Maybe there is hope for a future centos, then.

Just another few data points...

I was able to recreate this issue on a CentOS 7 system running in a
tmpfs filesystem.  So that's pretty much pointing directly at the
Linux kernel behavior independent of file system type.

Meanwhile...  I can also recreate this on a Debian system with a Linux
4.9 kernel in 9 Stretch.  But not on 10 Buster Linux 4.19.  But once
again not on an earlier Linux 3.2 kernel.  3.2 good, 4.9 bad, 4.19 good.

Therefore this seems to be a Linux behavior that was the desired way,
then flipped to the annoying behavior way, then has flipped back again
later.  Apparently.  Anyway just a few data points.

Bob





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 19 Oct 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 188 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.