Bug 1040710 - --include not working as expected
Summary: --include not working as expected
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: grep
Version: 6.4
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks: 994246 1077108
TreeView+ depends on / blocked
 
Reported: 2013-12-12 00:06 UTC by Dave Sullivan
Modified: 2018-12-05 16:45 UTC (History)
4 users (show)

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.
Clone Of:
Environment:
Last Closed: 2014-10-22 07:14:48 UTC
Target Upstream Version:


Attachments (Terms of Use)
Backported upstream patch (1.08 KB, patch)
2013-12-12 10:22 UTC, Jaroslav Škarvada
no flags Details | Diff

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


Note You need to log in before you can comment on or make changes to this bug.