svn commit: r267693 - head/usr.bin/grep

Glen Barber gjb at FreeBSD.org
Fri Jun 20 21:53:51 UTC 2014


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)


More information about the svn-src-head mailing list