Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jun 2014 21:53:51 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267693 - head/usr.bin/grep
Message-ID:  <201406202153.s5KLrpbu052771@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Fri Jun 20 21:53:50 2014
New Revision: 267693
URL: http://svnweb.freebsd.org/changeset/base/267693

Log:
  Fix a bug in bsdgrep(1) where patterns are not correctly
  detected.
  
  Certain criteria must be met for this bug to show up:
  
   * the -w flag is specified, and
   * neither -o or --color are specified, and
   * the pattern is part of another word in the line, and
   * the other word that contains the pattern occurs first
  
  PR:		181973
  MFC after:	3 days
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==============================================================================
--- head/usr.bin/grep/util.c	Fri Jun 20 21:41:30 2014	(r267692)
+++ head/usr.bin/grep/util.c	Fri Jun 20 21:53:50 2014	(r267693)
@@ -336,7 +336,7 @@ procline(struct str *l, int nottext)
 		}
 
 		/* One pass if we are not recording matches */
-		if ((color == NULL && !oflag) || qflag || lflag)
+		if (!wflag && ((color == NULL && !oflag) || qflag || lflag))
 			break;
 
 		if (st == (size_t)pmatch.rm_so)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406202153.s5KLrpbu052771>