[Bug 651867] Re: --include does the same as --exclude!

Margarita Manterola marga at google.com
Thu Mar 14 18:53:19 UTC 2013


Hi, this bug was supposedly fixed, but then it was broken again.  This is also reported in:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/1003742

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grep in Ubuntu.
https://bugs.launchpad.net/bugs/651867

Title:
  --include does the same as --exclude!

Status in “grep” package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: grep

  > lsb_release -rd
  Description:    Ubuntu maverick (development branch)
  Release:        10.10

  I'm using maverick beta that contains grep 2.6.3.

  When using the '--include' option to grep (mainly used for recursive
  matching), grep 2.6.3 does not behave as expected. In fact, it works
  like '--exclude', but only in the top level directory.

  Example:
  1. Create a subdirectory that contains two files "file.has" and "file.hasnot". Both files contain only the string 'test'.
  >mkdir test
  >cd test
  >echo "test" > file.has
  >echo "test" > file.hasnot

  2. Now I do:
  > grep --include="file.has" -l test *
  file.hasnot

  I would expect the command to output "file.has". The behavior shown is
  the behavior of "--exclude":

  > grep --exclude="file.has" -l test *
  file.hasnot

  This is not a very practical example and doesn't show the maximal
  confusion. So another demonstration:

  1. Create a new subdirectory and make an additional copy of the files into the subdir.
  > mkdir sub
  > cp file.* sub/

  2. Now do the above commands recursively:
  > grep -rl --include="file.has" test *
  file.hasnot
  sub/file.has
  > grep -rl --exclude="file.has" test *
  file.hasnot
  sub/file.hasnot

  This is definitely not the expected behavior.

  I have built an up-to-date grep (grep 2.7) from the GNU homepage, and
  this does not have the problematic behavior, so I guess the best
  solution is to upgrade grep.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/651867/+subscriptions




More information about the foundations-bugs mailing list