[Top][All Lists]

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

[bug #59012] find examples wrong in man page

From: anonymous
Subject: [bug #59012] find examples wrong in man page
Date: Tue, 25 Aug 2020 17:33:28 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0


                 Summary: find examples wrong in man page
                 Project: findutils
            Submitted by: None
            Submitted on: Tue 25 Aug 2020 09:33:26 PM UTC
                Category: documentation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Nils
        Originator Email: bugs2020@snailsen.de
             Open/Closed: Open
                 Release: 4.6.0
         Discussion Lock: Any
           Fixed Release: None



> find repo/ \( -exec test -d '{}'/.svn \; -or \
> -exec test -d {}/.git \; -or -exec test -d {}/CVS \; \) \
> -print -prune
>Given  the  following  directory of projects and their associated SCM
administrative directories, perform an efficient search for the projects'
> repo/project1/CVS
> repo/gnu/project2/.svn
> repo/gnu/project3/.svn
> repo/gnu/project3/src/.svn
> repo/project4/.git
>In this example, -prune prevents unnecessary descent into directories that
have already been discovered (for  example  we do not  search project3/src
because we already found >project3/.svn), but ensures sibling directories
(project2 and >project3) are found.

The above example from the find man page (from find (GNU findutils) is not producing the listed output. 
As the matching is performed on the directory name plus an extention using
-exec test '{}'/.svn the matching directory would be e.g. repo/project2 which
is giving a positive test on execution of test repo/project2/.svn. Therefore
find is printing only "repo/project2" (and not "repo/project2/.svn")

As -prune is used project3 is matching and therefore no descending into it
will be done. Based on this the sub folder src inside project3 can never be
found even though it also conatins a .svn folder.

The example is inconsitent in using quotations for the -exec action. in the
first exec action '{}' is used while in the second and third just {} is used.

Giving the folloing driectory tree:

The output of the example find produces the follwoing (expected) output which
is different from the documented example:

user@host:~/repo$ find ./ \( -exec test -d '{}'/.svn \; -or -exec test -d
'{}'/.git \; -or -exec test -d '{}'/CVS \; \) -print -prune


Reply to this item at:


  Message sent via Savannah

reply via email to

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