Bug 1040710

Summary: --include not working as expected
Product: Red Hat Enterprise Linux 6 Reporter: Dave Sullivan <dsulliva>
Component: grepAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.4CC: cww, jherrman, jkejda, mkolaja
Target Milestone: rcKeywords: Patch, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: grep-2.6.3-5.el6 Doc Type: Bug Fix
Doc Text:
Previously, the "--include" option did not process file names correctly. As a consequence, "--include" sometimes functioned as if the "--exclude" option was used. With this update, a patch has been applied to address the problem and "--include" now works correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-22 07:14:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 994246, 1077108    
Attachments:
Description Flags
Backported upstream patch none

Description Dave Sullivan 2013-12-12 00:06:00 UTC
Description of problem:

--include not working as expected

See "How reproducible" and "Additional info" for example


Version-Release number of selected component (if applicable):

2.6.3


How reproducible:


cseraphi@DESK 14:47:49 /tmp/test$ echo foo >1 ; echo foo > 2
cseraphi@DESK 14:47:54 /tmp/test$ grep -H foo *
1:foo
2:foo
cseraphi@DESK 14:48:00 /tmp/test$ grep --exclude 1 -H foo *
2:foo
cseraphi@DESK 14:48:03 /tmp/test$ grep --include 1 -H foo *
2:foo


Actual results:


Expected results:


Additional info:
We're experiencing strange behavior with grep that appears to be a known bug in 2.6.3.

http://savannah.gnu.org/bugs/index.php?29876

As you can see in the release notes below, 2.7 specifically mentions --include not working 

http://savannah.gnu.org/forum/forum.php?forum_id=6521

As an addendum-- in recursive mode, --include seems to work properly on subdirs.  Stuff specifically named on the command line behaves very differently from stuff brought in implicitly by recursion.

cseraphi@DESK 14:53:04 /tmp/test$ echo foo >1 ; echo foo > 2 ; echo foo > subdir/10; echo foo > subdir/20
cseraphi@DESK 14:53:12 /tmp/test$ grep --include 1 -H foo *
2:foo
cseraphi@DESK 14:53:17 /tmp/test$ grep -r --include 1 -H foo *
2:foo
cseraphi@DESK 14:53:20 /tmp/test$ grep -r --include 10 -H foo *
1:foo
2:foo
subdir/10:foo
cseraphi@DESK 14:53:34 /tmp/test$ grep -r --include 10 -H foo .
./subdir/10:foo


The commitdiff for the patch that our user seems to be referring to (http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commitdiff;h=9c45c193825d1f59e1d341e556ecf4adeb7a03a2) seems to basically show a '!' being dropped from a conditional

Comment 1 Jaroslav Škarvada 2013-12-12 10:22:14 UTC
Created attachment 835720 [details]
Backported upstream patch