From owner-freebsd-bugs Sat Feb 20 11:13:38 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from sturgeon.gonefishing.org (sturgeon.gonefishing.org [129.121.2.4]) by hub.freebsd.org (Postfix) with SMTP id 5204110E01 for ; Sat, 20 Feb 1999 11:13:17 -0800 (PST) (envelope-from monte@gonefishing.org) Received: (qmail 2639 invoked by uid 1001); 20 Feb 1999 19:13:14 -0000 From: "Monte Mitzelfelt" Date: 20 Feb 1999 12:13:14 -0700 Date: Sat, 20 Feb 1999 12:13:14 -0700 (MST) To: gnats-admin@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: bin/10169: find -perm doesn't allow a bitwise-& In-Reply-To: <199902200900.BAA02936@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Sat, 20 Feb 1999 gnats-admin@FreeBSD.org wrote: > Thank you very much for your problem report. > It has the internal identification `bin/10169'. > The individual assigned to look at your > report is: freebsd-bugs. > > >Category: bin > >Responsible: freebsd-bugs > >Synopsis: find -perm doesn't allow a bitwise-& on > >Arrival-Date: Sat Feb 20 01:00:01 PST 1999 > I'm including a fixed version of my patch. *** old/find.h Fri Oct 4 06:54:05 1996 --- find.h Thu Feb 18 00:15:17 1999 *************** *** 58,63 **** --- 58,64 ---- #define F_MTFLAG 1 /* fstype */ #define F_MTTYPE 2 #define F_ATLEAST 1 /* perm */ + #define F_ANY 2 /* perm */ int flags; /* private flags */ enum ntype type; /* plan node type */ union { *** old/find.1 Fri May 22 16:52:16 1998 --- find.1 Thu Feb 18 00:18:39 1999 *************** *** 268,274 **** in the comparison. If the mode is preceded by a dash (``\-''), this primary evaluates to true if at least all of the bits in the mode are set in the file's mode bits. ! If the mode is not preceded by a dash, this primary evaluates to true if the bits in the mode exactly match the file's mode bits. Note, the first character of a symbolic mode may not be a dash (``\-''). .It Ic -print --- 268,276 ---- in the comparison. If the mode is preceded by a dash (``\-''), this primary evaluates to true if at least all of the bits in the mode are set in the file's mode bits. ! If the mode is preceded by a plus (``\+''), this primary evaluates to true ! if any of the bits in the mode are set in the file's mode bits. ! Otherwise, this primary evaluates to true if the bits in the mode exactly match the file's mode bits. Note, the first character of a symbolic mode may not be a dash (``\-''). .It Ic -print *** old/function.c Sun Feb 2 11:57:22 1997 --- function.c Sat Feb 20 12:06:31 1999 *************** *** 741,746 **** --- 741,748 ---- (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); else return (mode == plan->m_data); /* NOTREACHED */ *************** *** 759,764 **** --- 761,769 ---- if (*perm == '-') { new->flags = F_ATLEAST; + ++perm; + } else if (*perm == '+') { + new->flags = F_ANY; ++perm; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message