[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23853: chmod can unset sticky bits using octet format
From: |
Eric Blake |
Subject: |
bug#23853: chmod can unset sticky bits using octet format |
Date: |
Mon, 27 Jun 2016 08:13:20 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 06/26/2016 06:56 PM, westlake wrote:
> According to chmod's manpage,
> "chmod preserves a directory's set-user-ID and set-group-ID bits unless
> you explicitly specify otherwise. You can set or clear the bits with
> symbolic modes like u+s and g-s, and you can set (but not clear) the
> bits with a numeric mode."
>
> contrary to documentation, chmod can otherwise clear sticky bits using
> the octet notation but by using a 5th octal
>
> commands used,
> mkdir abc
> chmod u+s,g+s abc
> chmod 0755 abc (no effect on the sticky bits)
> chmod 00755 abc (sticky bits cleared using the 5th octal position)
The behavior of the 5th octal to intentionally specify that the
otherwise leading 0 is intended to clear sticky bits is intentional, so
the only bug here is in the documentation for not making the intended
behavior more obvious.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature