From owner-svn-src-all@FreeBSD.ORG Fri Jun 20 21:53:51 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C9FB181; Fri, 20 Jun 2014 21:53:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A8032F3C; Fri, 20 Jun 2014 21:53:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5KLrpuR052772; Fri, 20 Jun 2014 21:53:51 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5KLrpbu052771; Fri, 20 Jun 2014 21:53:51 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201406202153.s5KLrpbu052771@svn.freebsd.org> From: Glen Barber Date: Fri, 20 Jun 2014 21:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267693 - head/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 21:53:51 -0000 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)