GNU bug report logs - #29390
chmod man page - clear setuid/setgid with numerical value

Previous Next

Package: coreutils;

Reported by: Oliver Isaac <oisaac <at> gmail.com>

Date: Wed, 22 Nov 2017 03:01:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

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 29390 in the body.
You can then email your comments to 29390 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#29390; Package coreutils. (Wed, 22 Nov 2017 03:01:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oliver Isaac <oisaac <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 22 Nov 2017 03:01:02 GMT) Full text and rfc822 format available.

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

From: Oliver Isaac <oisaac <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: chmod man page - clear setuid/setgid with numerical value 
Date: Tue, 21 Nov 2017 20:46:33 -0600
Hello,

There is an incorrect assertion made in the chmod man page:

Under the setuid/setgid header it says, "you can set (but not clear) the bits with a numeric mode"

This is not entirely true. If you prefix your numeric mode with a 0 then it will work:

e.g.:

touch myfile
chmod 644 myfile
ls -l myfile
chmod g+s myfile
Is -l myfile
chmod 00644 myfile
is -l myfile


This simple test shows that you can clear the uid/gid bits with numeric mode which is especially useful in scripts.

An update to the man page to clarify this would be helpful. 

Thanks,
Oliver



Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sun, 10 Dec 2017 02:34:01 GMT) Full text and rfc822 format available.

Notification sent to Oliver Isaac <oisaac <at> gmail.com>:
bug acknowledged by developer. (Sun, 10 Dec 2017 02:34:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Oliver Isaac <oisaac <at> gmail.com>, 29390-done <at> debbugs.gnu.org
Subject: Re: bug#29390: chmod man page - clear setuid/setgid with numerical
 value
Date: Sat, 9 Dec 2017 18:32:53 -0800
[Message part 1 (text/plain, inline)]
On 21/11/17 18:46, Oliver Isaac wrote:
> Hello,
> 
> There is an incorrect assertion made in the chmod man page:
> 
> Under the setuid/setgid header it says, "you can set (but not clear) the bits with a numeric mode"
> 
> This is not entirely true. If you prefix your numeric mode with a 0 then it will work:
> 
> e.g.:
> 
> touch myfile
> chmod 644 myfile
> ls -l myfile
> chmod g+s myfile
> Is -l myfile
> chmod 00644 myfile
> is -l myfile
> 
> 
> This simple test shows that you can clear the uid/gid bits with numeric mode which is especially useful in scripts.
> 
> An update to the man page to clarify this would be helpful. 

Yes we should update the man page to be consistent.

The current text was added in COREUTILS-6_9-89-gf4a5097
It was correct at the time, but slightly ambiguous as it
might be missed that the paragraph pertains only to directories,
and not files.

Then http://debbugs.gnu.org/8391 (v8.15-64-g8931cdb) changed things
to allow leading 00 to clear the setuid and setgid bits
of _directories_ with numeric modes.  BTW I notice solaris
accepts 00755 as a mode but does _not_ clear these bits
for directories.

I.E. the most portable and simplest way to access this functionality
is to use `chmod -s dir`

Proposed patch attached.

cheers,
Pádraig
[chmod-setgid-man.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Jan 2018 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 110 days ago.

Previous Next


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