[Top][All Lists]

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

Re: Bug or changed behaviour in GNU find?

From: James Youngman
Subject: Re: Bug or changed behaviour in GNU find?
Date: Tue, 27 Nov 2012 17:57:57 +0000

On Tue, Nov 27, 2012 at 3:14 PM, Marcel Loose <address@hidden> wrote:
> Hi,
> I recently stumbled upon something that IMHO is a bug in recent versions
> of GNU find. See the following example below to see what I mean:
> $ ls
> foo.cc  foo.h  foo.tcc
> $ find --version
> find (GNU findutils) 4.4.2
> Copyright (C) 2007 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Written by Eric B. Decker, James Youngman, and Kevin Dalley.
> Built using GNU gnulib version e5573b1bad88bfabcda181b9e0125fb0c52b7d3b
> Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS() 
> CBO(level=0)
> $ find . -name "*.h" -o -name "*.cc" -o -name "*.tcc"
> ./foo.h
> ./foo.cc
> ./foo.tcc
> $ find . -name "*.h" -o -name "*.cc" -o -name "*.tcc" -print0 | tr '\0' '\n'
> ./foo.tcc
> IIRC this used to work with older version of find. Has something changed
> in find's behaviour, or am I missing something else here?

Yes; parentheses.

Find is required (by POSIX) to work this way.   The manpage states:

        If the expression contains no actions other than -prune,
-print is performed on all files for which the expression is true.


reply via email to

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