Closed nalajcie closed 4 years ago
Previous find invocation applied -type f only to the last name wildcard (part after last -or").
find
-type f
This patch fixes it by using the correct find syntax.
Testcase:
$ mkdir -p search/dir.c search/dir.h; touch search/file.c search/file.h $ find search -name \*.c -or -name \*.h -type f search/dir.c search/file.h search/file.c
The search/dir.c result is invalid.
search/dir.c
$ find search -type f \( -name \*.c -or -name \*.h \) search/file.h search/file.c
Additionally, the stderr output is redirected to /dev/null to avoid mangling vim screen in case some directories in the search path are not accessible by the user, eg:
$ chmod 400 search $ find search -name \*.c -or -name \*.h -type f find: 'search/dir.c': Permission denied search/dir.c find: 'search/dir.h': Permission denied search/file.h search/file.c $ find search -name \*.c -or -name \*.h -type f 2>/dev/null search/dir.c search/file.h search/file.c
Thanks for the quality PR and description!
Previous
find
invocation applied-type f
only to the last name wildcard (part after last -or").This patch fixes it by using the correct
find
syntax.Testcase:
The
search/dir.c
result is invalid.Additionally, the stderr output is redirected to /dev/null to avoid mangling vim screen in case some directories in the search path are not accessible by the user, eg: