Subject: bin/12536: find defaults to -printing -pruned off -or expressions
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 04/03/2001 12:47:06
>Number: 12536
>Category: bin
>Synopsis: find defaults to -printing -pruned off -or expressions
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Apr 03 09:48:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: John Hawkinson
>Release: NetBSD 1.5
>Organization:
MIT
>Environment:
System: NetBSD zorkmid.mit.edu 1.5T NetBSD 1.5T (ZORKMID-$Revision: 1.8 $) #91: Mon Apr 2 16:17:26 EDT 2001 jhawk@zorkmid.mit.edu:/usr/local/netbsd-current/src/sys/arch/i386/compile/ZORKMID i386
>Description:
When the find command has two operands of an -or operator,
if no -print is specified, it defaults to applying -print to both operands,
not merely to the second operand.
This is particularly confusing in light of -prune.
Adding a "-print" to the end of the expression fixes this.
>How-To-Repeat:
For instance, this has the unexpected result of printing
"./disklabels" as well as pruning it:
zorkmid% find . -name disklabels -prune -o -type d | head
.
./disklabels
./kerberosIV
./mtree
./namedb
./postfix
./skel
./sliphome
./uucp
./RCS
To suppress printing of "./disklabels", one must explicitly
specify print for the second operand of the -or:
zorkmid% find . -name disklabels -prune -o -type d -print | head
.
./kerberosIV
./mtree
./namedb
./postfix
./skel
./sliphome
./uucp
./RCS
./ppp
This seems hokey. The Solaris find doesn't have this problem,
but gnu find appears to.
>Fix:
WORKAROUND: Append -print.
>Release-Note:
>Audit-Trail:
>Unformatted: