bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POSIX conformance question on -perm


From: Eric Blake
Subject: POSIX conformance question on -perm
Date: Mon, 1 Feb 2021 11:02:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0

In today's Austin Group meeting (the folks responsible for the POSIX
standard), the following question was raised:

https://austingroupbugs.net/view.php?id=1392

"The below proposed wording change would make gnu find non-conforming.
Their behavior seems to be intentional
(https://git.savannah.gnu.org/cgit/findutils.git/commit/?id=0da0554e49);
would they be willing to change their implementation?"

Here's the proposed change, either we can express a willingness to
change findutils to match (changing commit 0da0554e49), or we should
propose alternative wording that permits the difference in behavior for
GNU find vs. other find implementations along with an explanation why
the difference is worth preserving.

On page 2797 lines 91951-91959 change:

    <blockquote>The mode argument is used to represent file mode bits.
It shall be identical in format to the <i>symbolic_mode</i> operand
described in <i>chmod</i>, and shall be interpreted as follows. To
start, a template shall be assumed with all file mode bits cleared. An
<i>op</i> symbol of '+' shall set the appropriate mode bits in the
template; '?' shall clear the appropriate bits; '=' shall set the
appropriate mode bits, without regard to the contents of the file mode
creation mask of the process. The <i>op</i> symbol of '?' cannot be the
first character of mode; this avoids ambiguity with the optional leading
<hyphen-minus>. Since the initial mode is all bits off, there are not
any symbolic modes that need to use '?' as the first character.</blockquote>

to:

    <blockquote>The <i>mode</i> argument is used to represent file mode
bits. It shall be processed in an identical matter to the
<i>symbolic_mode</i> operand described in <i>chmod</i>, except that:

    <ol>

    <li>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.</li>

    <li>The <i>op</i> symbol '-' cannot be the first character of
<i>mode</i>; this avoids ambiguity with the optional leading
<hyphen-minus>. Since the initial mode is all bits off, there are not
any symbolic modes that need to use '-' as the first character.</li>

    </ol></blockquote>


On page 2801 lines 92128-92130 (find example #3), change:

    <blockquote><pre>find . -perm ?o+w,+s</pre>

    prints (<b>-print</b> 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.</blockquote>

to:

    <blockquote><pre>find . -perm -o+w,+s</pre>

    prints (<b>-print</b> 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 S_ISUID and S_ISGID cannot be present in the
mask.)</blockquote>


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

    <blockquote><pre>find . -perm -+w</pre>

    prints (<b>-print</b> 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).</blockquote>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]