Bug 128645 - [patch] grep(1): teach grep -r to how to ignore directories
Summary: [patch] grep(1): teach grep -r to how to ignore directories
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: 8.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-06 11:50 UTC by Bjoern A. Zeeb
Modified: 2020-12-08 14:05 UTC (History)
4 users (show)

See Also:


Attachments
file.diff (4.03 KB, patch)
2008-11-06 11:50 UTC, Bjoern A. Zeeb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb 2008-11-06 11:50:00 UTC
With for example a SVN tree checked out grep -r is a pain as it also finds the .svn/* copies and thus gives duplicate results, ...

There is no way to tell grep to ignore .svn directories but only to ignore filenames based on patterns which works but not very well.

Fix: I have a patch is not great but it adds an --exclude-dir option so one could do
  grep -r --exlcude-dir .svn XXX-BZ sys/

It would need review and someone brave enough to commit to gnu/ ;-)

The patch is under GPLv2.

Patch attached with submission follows:
How-To-Repeat: checkout freebsd src tree from svn. From the toplevel do a
grep -r XXX-BZ sys/
Comment 1 Kyle Evans freebsd_committer freebsd_triage 2017-04-20 17:14:13 UTC
This will be a non-issue once bsdgrep replaces /usr/bin/grep -- this can probably safely be closed, since it seems that no one is brave enough to commit to gnu/. =P
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:57 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 3 Oleksandr Tymoshenko freebsd_committer freebsd_triage 2019-01-24 09:12:19 UTC
Closing as rejected since no one has picked it up. Feel free to reopen or resubmit to reviews.freebsd.org if there is still interest in seeing it in the tree.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-12-08 14:05:48 UTC
A commit references this bug:

Author: kevans
Date: Tue Dec  8 14:05:26 UTC 2020
New revision: 368439
URL: https://svnweb.freebsd.org/changeset/base/368439

Log:
  src.opts.mk: switch to bsdgrep as /usr/bin/grep

  This has been years in the making, and we all knew it was bound to happen
  some day. Switch to the BSDL grep implementation now that it's been a
  little more thoroughly tested and theoretically supports all of the
  extensions that gnugrep in base had with our libregex(3).

  Folks shouldn't really notice much from this update; bsdgrep is slower than
  gnugrep, but this is currently the price to pay for fewer bugs. Those
  dissatisfied with the speed of grep and in need of a faster implementation
  should check out what textproc/ripgrep and textproc/the_silver_searcher
  can do for them.

  I have some WIP to make bsdgrep faster, but do not consider it a blocker
  when compared to the pros of switching now (aforementioned bugs, licensing).

  PR:		228798 (exp-run)
  PR:		128645, 156704, 166842, 166862, 180937, 193835, 201650
  PR:		232565, 242308, 246000, 251081, 191086, 194397
  Relnotes:	yes, please

Changes:
  head/share/mk/src.opts.mk