Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Feb 1999 12:13:14 -0700 (MST)
From:      "Monte Mitzelfelt" <monte@gonefishing.org>
To:        gnats-admin@FreeBSD.org, freebsd-bugs@FreeBSD.org
Subject:   Re: bin/10169: find -perm <mode> doesn't allow a bitwise-&
Message-ID:  <Pine.NEB.3.96.990220121218.16089Y-100000@sturgeon.gonefishing.org>
In-Reply-To: <199902200900.BAA02936@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help


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 <mode> doesn't allow a bitwise-& on <mode>
> >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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.990220121218.16089Y-100000>