URL: <http://savannah.gnu.org/bugs/?52409>
Summary: `find -print0 -name ...` ignores `-name ...` Project: findutils Submitted by: None Submitted on: Tue 14 Nov 2017 11:46:44 PM UTC Category: find Severity: 3 - Normal Item Group: Wrong result Status: None Privacy: Public Assigned to: None Originator Name: Anthony Sottile Originator Email: asott...@umich.edu Open/Closed: Open Discussion Lock: Any Release: 4.6.0 Fixed Release: None _______________________________________________________ Details: The version I'm using ships with ubuntu xenial, but I also downloaded 4.6.0 and reproduced there: ``` $ find --version find (GNU findutils) 4.7.0-git Copyright (C) 2016 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. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) $ ./find/find --version find (GNU findutils) 4.6.0 Copyright (C) 2015 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. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) ``` Here's a toy testcase: ``` mkdir foo && cd foo touch foo.{a,b,c} # works, prints only `foo.c` find -name '*.c' # works, prints only `foo.c` find -name '*.c' -print0 | xargs -0 -n1 # BUG: prints . foo.a foo.b and foo.c find -print0 -name '*.c' | xargs -0 -n1 ``` Output: ``` $ mkdir foo && cd foo $ touch foo.{a,b,c} $ # works, prints only `foo.c` $ find -name '*.c' ./foo.c $ # works, prints only `foo.c` $ find -name '*.c' -print0 | xargs -0 -n1 ./foo.c $ # BUG: prints . foo.a foo.b and foo.c $ find -print0 -name '*.c' | xargs -0 -n1 . ./foo.a ./foo.b ./foo.c ``` _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?52409> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/