Hi,

On Mon, Mar 17, 2025 at 08:08:51AM -0400, Tavian Barnes wrote:
> On Mon, Mar 17, 2025 at 7:14 AM Roberto E. Vargas Caballero
> > I don't think this is correct. The results  of -perm should not depend
> > of the process umask. Why do you think -perm should use umask(2)?
> 
> POSIX bug 1392 clarified this: 
> https://www.austingroupbugs.net/view.php?id=1392

That link is very confusing to me:

        The changes to file mode bits shall be applied to a template
        instead of to any files. The template shall initially have
        all file mode bits cleared.


and later:

        to:

        find . −perm −o+w,+s

        prints (−print is assumed) the names of all files in or
        below the current directory, with all of the file permission
        bits S_ISUID, S_ISGID, and S_IWOTH set, regardless of the
        value of the file creation mask. (Note that the file creation
        mask is only specified for the file permission bits, and
        not S_ISUID, S_ISGID or S_ISVTX.)

So, with these two paragraphs I would say that the creation mask is
not used, but later it says:

        On page 2801 after line 92130 insert a new example #4 and
        renumber the remaining examples: The following command:

        find . −perm −+w

        prints (−print is assumed) the names of all files in or
        below the current directory, with S_IWUSR set if the file
        creation mask does not have S_IWUSR set (otherwise the
        S_IWUSR bit is ignored), S_IWGRP set if the file creation
        mask does not have S_IWGRP set (otherwise S_IWGRP is ignored),
        and S_IWOTH set if the file creation mask does not have
        S_IWOTH set (otherwise S_IWOTH is ignored).


where it says that we have to use the creation mask. What is the
difference between both examples? I understand that we have to use
always the creation mask excepts in the case of S_ISUID, S_ISGID
and S_ISVTX because they are not part of the creation mask. In that
case, the wording is very confusing.

Am I right about what it says? In that case then I think your patch
makes sense (and POSIX doesn't xD).

Kind regards,


Reply via email to