Bug 198725 - bsdgrep broken -f option since r268799
Summary: bsdgrep broken -f option since r268799
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Pedro F. Giffuni
URL:
Keywords: patch, regression
Depends on:
Blocks:
 
Reported: 2015-03-20 04:54 UTC by Stefan Grundmann
Modified: 2015-03-24 01:36 UTC (History)
1 user (show)

See Also:


Attachments
fix for broken -f option in bsdgrep (354 bytes, patch)
2015-03-20 04:54 UTC, Stefan Grundmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Grundmann 2015-03-20 04:54:19 UTC
Created attachment 154549 [details]
fix for broken -f option in bsdgrep

In r268799 the read_patterns function of grep.c was changed to use getline(3)
instead of fgetln(3).

The necessary change to the add_pattern call parameters is missing which breaks
the -f option.

The NetBSD grep.c (CVS Rev. 1.6) change that was supposed to be imported in this commit does not contain the mistake.

The test that is supposed to ensure that -f works is unfortunately only run with GNU grep (unless WITH_BSD_GREP=true is set).
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2015-03-21 00:00:08 UTC
Over to committer of https://svnweb.freebsd.org/base?view=revision&revision=268799 .
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-03-21 00:21:49 UTC
A commit references this bug:

Author: pfg
Date: Sat Mar 21 00:21:31 UTC 2015
New revision: 280307
URL: https://svnweb.freebsd.org/changeset/base/280307

Log:
  bsdgrep: fix regression in the -f option since r268799

  Caused by an incomplete merge from NetBSD.

  PR:		198725
  MFC after:	3 days

Changes:
  head/usr.bin/grep/grep.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-03-24 01:31:33 UTC
A commit references this bug:

Author: pfg
Date: Tue Mar 24 01:31:03 UTC 2015
New revision: 280408
URL: https://svnweb.freebsd.org/changeset/base/280408

Log:
  MFC	r280307:
  bsdgrep: fix regression in the -f option since r268799

  Caused by an incomplete merge from NetBSD.

  PR:		198725

Changes:
_U  stable/10/
  stable/10/usr.bin/grep/grep.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-03-24 01:33:34 UTC
A commit references this bug:

Author: pfg
Date: Tue Mar 24 01:32:47 UTC 2015
New revision: 280409
URL: https://svnweb.freebsd.org/changeset/base/280409

Log:
  MFC	r280307:
  bsdgrep: fix regression in the -f option since r268799

  Caused by an incomplete merge from NetBSD.

  PR:		198725

Changes:
_U  stable/9/usr.bin/grep/
  stable/9/usr.bin/grep/grep.c
Comment 5 Pedro F. Giffuni freebsd_committer freebsd_triage 2015-03-24 01:36:21 UTC
Huge thanks for finding the bug I introduced!