Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 1996 22:01:08 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-bugs@FreeBSD.org (FreeBSD bugs list)
Cc:        babbleon@mercury.interpath.com (Brian T. Schellenberger)
Subject:   Re: Bug: 2.1.0: chmod +s
Message-ID:  <199605022001.WAA14464@uriah.heep.sax.de>
In-Reply-To: <199605020521.BAA12293@mercury.interpath.com> from "Brian T. Schellenberger - Personal Account" at "May 2, 96 01:21:18 am"

next in thread | previous in thread | raw e-mail | index | archive | help
As Brian T. Schellenberger - Personal Account wrote:
> 
> The +s option to 2.1.0's chmod is broken; the numerical equivalent works
> just fine.  (Just do a chmod +s to a file; ls -l; then do a chmod 6755 or
> whatever, and ls -l).

Not specifying the `who' for +s seems to be a bit senseless to me, but
you're probably right, this is a minor nit in the implementation of
setmode(3).  I've re-read Posix.2 for this, and it's not fully clear
what to do.

I've thought about modifying it, but the result will be that
specifying ``+s'' would always be treated as ``ug+s'', since the
setuid and setgid bits are always clear in the umask.  While this is
more in the line of Posix (well, if you interpret it to the letter), i
consider it rather dangerous since an innocent attempt to turn on some
set*id bit without verification will most likely always result in
making the file setuid _and_ setgid.  This is most likely _never_ what
has been intended.

Unless somebody really thinks we should change the current behaviour,
i'm more for keeping it as it is (even though i've now spent half an
hour in investigating this, and have the patch ready).

For those who are interested, it's in src/lib/libc/gen/setmode.c,
lines 257 ff.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605022001.WAA14464>