Bug 166862 - grep(1): grep [[:alnum:]]* only matches once
Summary: grep(1): grep [[:alnum:]]* only matches once
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-12 01:50 UTC by Jim Pryor
Modified: 2024-04-29 07:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Pryor 2012-04-12 01:50:13 UTC
This behaves as expected:
$ printf '_abc d_ef 1ghi' | grep -o '[[:alnum:]_]\+'
_abc
d_ef
1ghi

But this gives only a single match:
 8:36 PM vaio pts8 .../arch/usr/share/man $ printf '_abc d_ef 1ghi' | grep -o '[[:alnum:]_]*'
_abc

Same results if we use egrep instead, or use "\w" instead of "[[:alnum:]_]".

grep version line:
/* $FreeBSD: src/usr.bin/grep/grep.c,v 1.11.2.3 2011/10/20 16:08:11 gabor Exp $
Comment 1 Kyle Evans freebsd_committer freebsd_triage 2017-04-20 16:52:00 UTC
This becomes a non-issue once bsdgrep becomes /usr/bin/grep; until then, it is indeed still a problem with gnugrep (and not libgnuregex).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-21 00:00:02 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 commit-hook freebsd_committer freebsd_triage 2020-12-08 14:05:51 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