From owner-svn-src-head@freebsd.org Fri May 4 03:13:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 064A9FC5101; Fri, 4 May 2018 03:13:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8142724DB; Fri, 4 May 2018 03:13:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A31461018; Fri, 4 May 2018 03:13:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w443DQMD004810; Fri, 4 May 2018 03:13:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w443DQpP004804; Fri, 4 May 2018 03:13:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201805040313.w443DQpP004804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 May 2018 03:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333236 - in head: share/mk tools/build/options usr.bin/grep usr.bin/grep/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/mk tools/build/options usr.bin/grep usr.bin/grep/regex X-SVN-Commit-Revision: 333236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2018 03:13:27 -0000 Author: kevans Date: Fri May 4 03:13:25 2018 New Revision: 333236 URL: https://svnweb.freebsd.org/changeset/base/333236 Log: bsdgrep: annihilate our in-tree TRE, previously disabled by default It was an old TRE that had plenty of bugs and no performance gain over regex(3). I disabled it by default in r323615, and there was some confusion about what the knob does- likely due to poor naming on my part- to the tune of "well, it sounds like it should speed things up" (mentioned by multiple people). To compound this, I have no intention of maintaining a second regex implementation. If someone would like to step up and volunteer to maintain a lean-and-mean implementation for grep, this is OK, but we have very few volunteers to maintain even our primary regex implementation. Deleted: head/tools/build/options/WITHOUT_BSD_GREP_FASTMATCH head/tools/build/options/WITH_BSD_GREP_FASTMATCH head/usr.bin/grep/regex/ Modified: head/share/mk/bsd.prog.mk head/share/mk/src.opts.mk head/usr.bin/grep/Makefile head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/share/mk/bsd.prog.mk ============================================================================== --- head/share/mk/bsd.prog.mk Fri May 4 01:36:49 2018 (r333235) +++ head/share/mk/bsd.prog.mk Fri May 4 03:13:25 2018 (r333236) @@ -271,6 +271,7 @@ SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} STAGE_AS_${script:T}= ${SCRIPTSDIR_${script:T}}/${SCRIPTSNAME_${script:T}} _scriptsinstall: _SCRIPTSINS_${script:T} + echo ">SFD>F>DF YES" _SCRIPTSINS_${script:T}: ${script} ${INSTALL} ${TAG_ARGS} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Fri May 4 01:36:49 2018 (r333235) +++ head/share/mk/src.opts.mk Fri May 4 03:13:25 2018 (r333236) @@ -187,7 +187,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BSD_GREP \ - BSD_GREP_FASTMATCH \ CLANG_EXTRAS \ DTRACE_TESTS \ GNU_GREP_COMPAT \ Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/Makefile Fri May 4 03:13:25 2018 (r333236) @@ -17,15 +17,6 @@ bsdgrep.1: grep.1 .endif SRCS= file.c grep.c queue.c util.c -.if ${MK_BSD_GREP_FASTMATCH} == "yes" -# Extra files ported backported for some regex improvements -.PATH: ${.CURDIR}/regex -SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c -CFLAGS+=-I${.CURDIR}/regex -.else -CFLAGS+= -DWITHOUT_FASTMATCH -.endif - SCRIPTS= zgrep.sh LINKS= ${BINDIR}/zgrep ${BINDIR}/zfgrep \ ${BINDIR}/zgrep ${BINDIR}/zegrep \ Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/grep.c Fri May 4 03:13:25 2018 (r333236) @@ -51,9 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif #include "grep.h" #ifndef WITHOUT_NLS @@ -96,9 +93,6 @@ unsigned int patterns; static unsigned int pattern_sz; struct pat *pattern; regex_t *r_pattern; -#ifndef WITHOUT_FASTMATCH -fastmatch_t *fg_pattern; -#endif /* Filename exclusion/inclusion patterns */ unsigned int fpatterns, dpatterns; @@ -712,9 +706,6 @@ main(int argc, char *argv[]) usage(); } -#ifndef WITHOUT_FASTMATCH - fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern)); -#endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); /* Don't process any patterns if we have a blank one */ @@ -725,15 +716,6 @@ main(int argc, char *argv[]) #endif /* Check if cheating is allowed (always is for fgrep). */ for (i = 0; i < patterns; ++i) { -#ifndef WITHOUT_FASTMATCH - /* - * Attempt compilation with fastmatch regex and - * fallback to regex(3) if it fails. - */ - if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) == 0) - continue; -#endif c = regcomp(&r_pattern[i], pattern[i].pat, cflags); if (c != 0) { regerror(c, &r_pattern[i], re_error, Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/grep.h Fri May 4 03:13:25 2018 (r333236) @@ -38,10 +38,6 @@ #include #include -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif - #ifdef WITHOUT_NLS #define getstr(n) errstr[n] #else @@ -131,9 +127,6 @@ extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; extern regex_t *er_pattern, *r_pattern; -#ifndef WITHOUT_FASTMATCH -extern fastmatch_t *fg_pattern; -#endif /* For regex errors */ #define RE_ERROR_BUF 512 Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Fri May 4 01:36:49 2018 (r333235) +++ head/usr.bin/grep/util.c Fri May 4 03:13:25 2018 (r333236) @@ -52,9 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifndef WITHOUT_FASTMATCH -#include "fastmatch.h" -#endif #include "grep.h" static bool first_match = true; @@ -512,14 +509,8 @@ procline(struct parsec *pc) r = litexec(&pattern[i], pc->ln.dat, 1, &pmatch); else #endif -#ifndef WITHOUT_FASTMATCH - if (fg_pattern[i].pattern) - r = fastexec(&fg_pattern[i], - pc->ln.dat, 1, &pmatch, leflags); - else -#endif - r = regexec(&r_pattern[i], pc->ln.dat, 1, - &pmatch, leflags); + r = regexec(&r_pattern[i], pc->ln.dat, 1, &pmatch, + leflags); if (r != 0) continue; /* Check for full match */ @@ -527,11 +518,7 @@ procline(struct parsec *pc) (size_t)pmatch.rm_eo != pc->ln.len)) continue; /* Check for whole word match */ -#ifndef WITHOUT_FASTMATCH - if (wflag || fg_pattern[i].word) { -#else if (wflag) { -#endif wbegin = wend = L' '; if (pmatch.rm_so != 0 && sscanf(&pc->ln.dat[pmatch.rm_so - 1],