Author: ian
Date: Sun Mar 13 14:53:12 2016
New Revision: 296799
URL: https://svnweb.freebsd.org/changeset/base/296799
Log:
Fix a bug in bsdgrep that caused the program to hang in a tight loop for
some combinations of command line options and search patterns. The code was
examining regexec flags looking for a regcomp flag value. The fix is to
look in the struct field where the decoded regcomp flag was stored when the
regex was compiled.
With this fix, it's possible to build WITHOUT_GNU_GREP_COMPAT and
WITH_BSDGREP and have a usable GPL-free grep (which of course lacks gnugrep
extensions). It now passes the kyua tests except for one test that requires
the -z/--null-data gnu extension, and one test involving outputting context
lines across multiple files which appears to sometimes output an extra
delimiter line ("--") between matches (a rather obscure failure of a rather
obscure feature, so bsdgrep should be generally usable now).
Modified:
head/usr.bin/grep/regex/glue.h
Modified: head/usr.bin/grep/regex/glue.h
==
--- head/usr.bin/grep/regex/glue.h Sun Mar 13 14:17:23 2016
(r296798)
+++ head/usr.bin/grep/regex/glue.h Sun Mar 13 14:53:12 2016
(r296799)
@@ -50,7 +50,7 @@ typedef enum { STR_WIDE, STR_BYTE, STR_M
if ((long long)pmatch[0].rm_eo - pmatch[0].rm_so < 0)\
return REG_NOMATCH; \
ret = fn;
\
- for (unsigned i = 0; (!(eflags & REG_NOSUB) && (i < nmatch)); i++)\
+ for (unsigned i = 0; (!preg->nosub && (i < nmatch)); i++)
\
{ \
pmatch[i].rm_so += offset;\
pmatch[i].rm_eo += offset;\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"