bug-findutils
[Top][All Lists]
Advanced

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

[bug #58654] -perm -+w does not behave like chmod (POSIX)


From: Bernhard Voelker
Subject: [bug #58654] -perm -+w does not behave like chmod (POSIX)
Date: Mon, 1 Feb 2021 20:46:40 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0

Follow-up Comment #9, bug #58654 (project findutils):

Thanks for the heads-up.

Especially thanks for the additional example.  However, it does
not look very enlightening to me.


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).


It is not very clear if the 3 conditions are logically OR-ed
or AND-ed.
Furthermore, in practice, `find -perm -+w` will output only
files which have ugo+w permissions, regardless of the current
umask, right?


$ for perm in u ug ugo uo g go o ; do \
    > f-$perm \
    && chmod a-rwx,$perm+w f-$perm; \
  done

$ ls -log f-*
-----w---- 1 0 Feb  2 02:39 f-g
-----w--w- 1 0 Feb  2 02:39 f-go
--------w- 1 0 Feb  2 02:39 f-o
--w------- 1 0 Feb  2 02:39 f-u
--w--w---- 1 0 Feb  2 02:39 f-ug
--w--w--w- 1 0 Feb  2 02:39 f-ugo
--w-----w- 1 0 Feb  2 02:39 f-uo

$ for u in 0000 0002 0022 0020 0222 0202 0220; do ( echo "umask: $u"; umask $u
&& find -perm -+w ); done
umask: 0000
./f-ugo
umask: 0002
./f-ugo
umask: 0022
./f-ugo
umask: 0020
./f-ugo
umask: 0222
./f-ugo
umask: 0202
./f-ugo
umask: 0220
./f-ugo



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58654>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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