Bug 167921 - bsdgrep(1) segfaults with "\\."
Summary: bsdgrep(1) segfaults with "\\."
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: Gabor Kovesdan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-15 14:10 UTC by c.kworr
Modified: 2015-07-12 15:28 UTC (History)
3 users (show)

See Also:
bugmeister: mfc-stable10?
bugmeister: mfc-stable9?
bugmeister: mfc-stable8?


Attachments
fix (506 bytes, patch)
2014-09-23 20:32 UTC, Pedro F. Giffuni
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description c.kworr 2012-05-15 14:10:04 UTC
Reinstalling textproc/docbook results in:

===>  Checking if textproc/docbook-410 already installed
files=$(/usr/bin/find /tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work -type f | /usr/bin/grep -v "/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/\."); 
 for i in ${files}; do  install -C  -o root -g wheel -m 444 ${i} /usr/local/share/sgml/docbook/4.1/dtd;  done
*** Error code 1

This means:

/usr/bin/find /tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work -type f | /usr/bin/grep -v "/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/\." | wc -l
 0

/usr/bin/find /tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work -type f | /usr/bin/grep "/tmp/ports/.amd_mnt/faz/host/usr/por
ts/textproc/docbook-410/work/\\."
Segmentation fault

And only this one works:

/usr/bin/find /tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work -type f | /usr/bin/grep -v "/tmp/ports/\.amd_mnt/faz/host/usr
/ports/textproc/docbook-410/work/\."                                                                                                                                                      
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/40chg.txt
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/50issues.txt
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/cals-tbl.dtd
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/dbcent.mod
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/dbgenent.mod
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/dbhier.mod
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/dbnotn.mod
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/dbpool.mod
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/docbook.cat
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/docbook.dcl
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/docbook.dtd
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/readme.txt
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/41chg.txt
/tmp/ports/.amd_mnt/faz/host/usr/ports/textproc/docbook-410/work/ChangeLog

Fix: 

This is definitely bug BSD_GREP, but whole installation thing can be simplified with:

  files=$$(${FIND} ${WRKSRC} -type f | ${GREP} -v "${WRKSRC}/\."); \

  files=$$(${FIND} ${WRKSRC} -type f \! -name '.*'); \
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-05-15 14:10:21 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gabor

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-05-23 18:02:48 UTC
gabor       2012-05-23 17:02:34 UTC

  FreeBSD ports repository

  Modified files:
    textproc/docbook-241 Makefile 
    textproc/docbook-300 Makefile 
    textproc/docbook-310 Makefile 
    textproc/docbook-400 Makefile 
    textproc/docbook-410 Makefile 
  Log:
  - Simplify install process (no functional changes)
  
  PR:             ports/167921 (related)
  Submitted by:   Volodymyr Kostyrko <c.kworr@gmail.com>
  
  Revision  Changes    Path
  1.21      +1 -1      ports/textproc/docbook-241/Makefile
  1.22      +1 -1      ports/textproc/docbook-300/Makefile
  1.30      +1 -1      ports/textproc/docbook-310/Makefile
  1.19      +1 -1      ports/textproc/docbook-400/Makefile
  1.19      +1 -1      ports/textproc/docbook-410/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Gabor Kovesdan freebsd_committer freebsd_triage 2012-05-23 18:02:52 UTC
State Changed
From-To: open->analyzed

The suggested workaround (which is actually an improvement) has been committed 
to the affected DocBook ports.  The problem in bsdgrep is still to be 
fixed.  PR reclassified accordingly. 
Thanks for your report.
Comment 4 Volodymyr Kostyrko 2014-06-26 13:11:23 UTC
The bug is still here, it's presence can be tested with:

    : | grep "\\."

I'm on ^/stable/10, grep (BSD grep) 2.5.1-FreeBSD
Comment 5 Pedro F. Giffuni freebsd_committer freebsd_triage 2014-09-23 20:32:14 UTC
Created attachment 147624 [details]
fix

Patch submitted by David Carlier (david.carlier at hardenedbsd)
Comment 6 commit-hook freebsd_committer freebsd_triage 2014-09-25 19:23:19 UTC
A commit references this bug:

Author: pfg
Date: Thu Sep 25 19:22:27 UTC 2014
New revision: 272127
URL: http://svnweb.freebsd.org/changeset/base/272127

Log:
  bsdgrep: Work-around for segmentation fault.

  Fix by David Carlier.

  Obtained from:	HardenedBSD
  PR:		167921
  MFC after:	1 month

Changes:
  head/usr.bin/grep/regex/tre-fastmatch.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2014-11-20 19:35:53 UTC
A commit references this bug:

Author: emaste
Date: Thu Nov 20 19:35:29 UTC 2014
New revision: 274757
URL: https://svnweb.freebsd.org/changeset/base/274757

Log:
  bsdgrep: Work-around for segmentation fault.

  Fix by David Carlier.

  MFC of r272127
  Obtained from:	HardenedBSD
  PR:		167921

Changes:
_U  stable/10/
  stable/10/usr.bin/grep/regex/tre-fastmatch.c
Comment 8 Glen Barber freebsd_committer freebsd_triage 2015-07-08 18:32:15 UTC
To originators/assignees of this PR:

A commit to the tree references this PR, however the PR is still in a non-closed state.

Please review this PR and close as appropriate, or if closing the PR requires a merge to stable/10, please let re@ know as soon as possible.

Thank you.

Glen
Comment 9 c.kworr 2015-07-12 12:44:01 UTC
Well, current status is: stable-10 - merged, stable-9 - not merged. The fix hasn't made into any release yet.
Comment 10 commit-hook freebsd_committer freebsd_triage 2015-07-12 15:25:02 UTC
A commit references this bug:

Author: pfg
Date: Sun Jul 12 15:24:06 UTC 2015
New revision: 285419
URL: https://svnweb.freebsd.org/changeset/base/285419

Log:
  bsdgrep: Work-around for segmentation fault.

  Fix by:	David Carlier.

  Obtained from:	HardenedBSD
  PR:		167921

Changes:
_U  stable/9/usr.bin/grep/
  stable/9/usr.bin/grep/regex/tre-fastmatch.c
Comment 11 Pedro F. Giffuni freebsd_committer freebsd_triage 2015-07-12 15:28:43 UTC
Merging this was not urgent as bsdgrep is not the default grep.
It has been merged now to -stable9, so the Bug is being closed.