Re: [hackers] [sbase][PATCH 5/6] libutil/mode: Fix sticky bit parsing
Tavian Barnes <tavianator_AT_tavianator.com> wrote:
> ---
> libutil/mode.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libutil/mode.c b/libutil/mode.c
> index b3632ad..2754be7 100644
> --- a/libutil/mode.c
> +++ b/libutil/mode.c
> _AT_@ -40,10 +40,10 @@ next:
> who |= S_IRWXG|S_ISGID;
> continue;
> case 'o':
> - who |= S_IRWXO;
> + who |= S_IRWXO|S_ISVTX;
> continue;
> case 'a':
> - who |= S_IRWXU|S_ISUID|S_IRWXG|S_ISGID|S_IRWXO;
> + who |= S_IRWXU|S_ISUID|S_IRWXG|S_ISGID|S_IRWXO|S_ISVTX;
> continue;
> }
> break;
Thanks for catching this.
POSIX says this on the matter:
> The perm symbol t shall specify the S_ISVTX bit. When used with
> a file of type directory, it can be used with the who symbol a,
> or with no who symbol. It shall not be an error to specify a who
> symbol of u, g, or o in conjunction with the perm symbol t, but
> the meaning of these combinations is unspecified.
So indeed a "who" of 'a' should include S_ISVTX.
But it also says that o with t is unspecified. Can you give some
context about the motivation for including S_ISVTX? Is it to match
other existing implementations? Or maybe there is some common
use-case for o+t?
Received on Mon Mar 17 2025 - 20:40:21 CET
This archive was generated by hypermail 2.3.0
: Mon Mar 17 2025 - 21:48:38 CET