Valery Ushakov wrote in
 <akbzeuk348wpj...@snips.stderr.spb.ru>:
 |On Thu, Aug 14, 2025 at 12:15:25 +0200, Rocky Hotas wrote:
 |
 |> It seems to work, but it's somewhat cumbersome.  In GNU find, there
 |> is a single dedicated option, `-executable'.
 |
 |-executable is, like test -x, an access(2) test.  The simple bitmask
 |test, as has already been mentioned upthread, is -perm /0111
 |
 |I stumble into this from time to time, when I need it and by habit
 |type the deprecated old syntax -perm +mode which, apparently, hasn't
 |been supported for 20 years now.
 |
 |Adding /mode to netbsd find(1) would be nice, I think. (And I just
 |auto-typed that as +mode first, and had to go back and correct
 |it... *sigh*).

dunno if this is it, untested.

 |-uwe
 --End of <akbzeuk348wpj...@snips.stderr.spb.ru>

diff -Napru '--color=auto' '--palette=rs=0:hd=1:ad=38;5;42:de=38;5;203:ln=36' 
y.orig/find.h y/find.h
--- y.orig/find.h       2025-08-16 17:47:30.785938602 +0200
+++ y/find.h    2025-08-16 17:48:14.695937766 +0200
@@ -62,6 +62,7 @@ typedef struct _plandata {
 #define        F_MTFLAG        1                       /* fstype */
 #define        F_MTTYPE        2
 #define        F_ATLEAST       1                       /* perm */
+#define        F_ANY           2
        int flags;                              /* private flags */
        enum ntype type;                        /* plan node type */
        union {
diff -Napru '--color=auto' '--palette=rs=0:hd=1:ad=38;5;42:de=38;5;203:ln=36' 
y.orig/function.c y/function.c
--- y.orig/function.c   2025-08-16 17:44:15.818255875 +0200
+++ y/function.c        2025-08-16 17:47:42.432605040 +0200
@@ -1532,6 +1532,8 @@ f_perm(PLAN *plan, FTSENT *entry)
            (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO);
        if (plan->flags == F_ATLEAST)
                return ((plan->m_data | mode) == mode);
+       else if (plan->flags == F_ANY)
+               return ((plan->m_data & mode) != 0);
        else
                return (mode == plan->m_data);
        /* NOTREACHED */
@@ -1552,6 +1554,9 @@ c_perm(char ***argvp, int isok, char *op
        if (*perm == '-') {
                new->flags = F_ATLEAST;
                ++perm;
+       } else if (*perm == '/') {
+               new->flags = F_ANY;
+               ++perm;
        }
 
        if ((set = setmode(perm)) == NULL)

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to