URL: <https://savannah.gnu.org/bugs/?59012>
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: bugs2...@snailsen.de Open/Closed: Open Release: 4.6.0 Discussion Lock: Any Fixed Release: None _______________________________________________________ Details: > 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' roots: > > 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) 4.6.0.225-235f) 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: ./gnu ./gnu/project2 ./gnu/project2/.svn ./gnu/project2/.svn/foobar ./gnu/project2/.svn/pristine ./gnu/project2/.svn/wc.db ./gnu/project3 ./gnu/project3/src ./gnu/project3/src/debug_out ./gnu/project3/src/.svn ./gnu/project3/src/.svn/pristine ./gnu/project3/src/.svn/wc.db ./gnu/project3/.svn ./gnu/project3/.svn/barfoo ./gnu/project3/.svn/wc.db ./project1 ./project1/CVS ./project1/CVS/foo ./project1/CVS/fooabr ./project4 ./project4/foobar ./project4/.git ./project4/.git/bakcup ./project4/.git/wb.git ./project4/test 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 ./project4 ./project1 ./gnu/project3 ./gnu/project2 _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?59012> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/