if grep is handed an pipe on standard in, it is not correctly checking if it's a directory before acting on the '-d recurse' option. from grep man page: -d ACTION, --directories=ACTION If an input file is a directory, use ACTION to process it. By default, ACTION is read, i.e., read directories just as if they were ordinary files. If ACTION is skip, silently skip directories. If ACTION is recurse, read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the -r option. behavior in Fedora 21: ahecox@localhost ~ $ which grep /bin/grep ahecox@localhost ~ $ grep -V grep (GNU grep) 2.21 Copyright (C) 2014 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 Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>. ahecox@localhost ~ $ file foo foo: cannot open `foo' (No such file or directory) ahecox@localhost ~ $ echo foo | grep foo foo ahecox@localhost ~ $ echo foo | grep -d recurse foo rpm-qa:foomatic-db-ppds-4.0-44.20140707.fc21.noarch rpm-qa:foomatic-4.0.11-6.fc21.x86_64 rpm-qa:foomatic-db-filesystem-4.0-44.20140707.fc21.noarch rpm-qa:foomatic-db-4.0-44.20140707.fc21.noarch .svn/pristine/89/893e400d588348f701bcbaf75e4a15903c40d4db.svn-base:#usage() { pusage: "foo"; } ... (many, many lines clipped, recursing starting in the CWD) previous versions behaved inline with the description of the man page (checking that the input is a directory before following the action). The latest test box I have is RHEL 6 (grep version 2.6.3) so not sure that this is a recent change. Let me know if I can help test or answer questions.
Could you provide reproducer? I.e. actions taken, expected result, current result? Thanks.
(In reply to Jaroslav Škarvada from comment #1) > Could you provide reproducer? I.e. actions taken, expected result, current > result? Thanks. hi Jaroslav, I provided steps in the description, please let me know what is unclear. -d recurse should only recurse if the input arguments are directories. In the reproducer the input in stdin. Let me know if that makes sense, thanks!
This seems to be wanted behaviour, upstream commit fixing the docs: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=c8b9364d5900a40809827aee6cc53705073278f6 So I will also fix the docs.
grep-2.21-5.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/grep-2.21-5.fc22
grep-2.21-3.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/grep-2.21-3.fc21
Package grep-2.21-5.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing grep-2.21-5.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-5677/grep-2.21-5.fc22 then log in and leave karma (feedback).
grep-2.21-3.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
Thanks Jaroslav
grep-2.21-5.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.