2020-11-08  Jim Meyering  <meyering@fb.com>

	version 3.6
	* NEWS: Record release date.

2020-11-05  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest for test improvements

2020-11-03  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest for C++-ready dfa.h and test-verify.c fix

2020-11-03  Paul Eggert  <eggert@cs.ucla.edu>

	grep: remove GREP_OPTIONS
	* NEWS: Mention this.
	* doc/grep.in.1:
	Remove GREP_OPTIONS documentation.
	* doc/grep.texi (Environment Variables):
	Move GREP_OPTIONS stuff into a “no longer implemented” paragraph.
	* src/grep.c (prepend_args, prepend_default_options): Remove.
	(main): Do not look at GREP_OPTIONS.
	* tests/Makefile.am (TESTS_ENVIRONMENTS):
	* tests/init.cfg (vars_): Remove GREP_OPTIONS.

2020-11-01  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: use RE_NO_SUB when calling regex solely to check syntax
	* src/dfasearch.c (regex_compile): New parameter. All callers changed.
	(GEAcompile): Move setting syntax for regex into regex_compile()
	function.  This addresses a performance problem exposed by extreme
	regular expressions, as described in https://bugs.gnu.org/43862 .

	tests: add the test for bugfix in gnulib's dfa
	* tests/ere.tests: Add new test.

2020-11-01  Jim Meyering  <meyering@fb.com>

	grep: avoid erroneous matches for e.g., a+a+a+
	* gnulib: Update to latest, for dfa's invalid-merge fix.
	* NEWS (Bug fixes): Mention this.

2020-10-11  Jim Meyering  <meyering@fb.com>

	grep: -P: report input filename upon PCRE execution failure
	Without this, it could be tedious to determine which input
	file evokes a PCRE-execution-time failure.
	* src/pcresearch.c (Pexecute): When failing, include the
	error-provoking file name in the diagnostic.
	* src/grep.c (input_filename): Make extern, since used above.
	* src/search.h (input_filename): Declare.
	* tests/filename-lineno.pl: Test for this.
	($no_pcre): Factor out.
	* NEWS (Bug fixes): Mention this.

2020-10-11  Paul Eggert  <eggert@cs.ucla.edu>

	grep: minor kwset cleanups
	* src/kwsearch.c (Fexecute):
	Assume C99 to put declarations nearer uses.
	* src/kwset.c (bmexec): Omit unnecessary test.
	* src/kwset.h (struct kwsmatch): Make OFFSET and SIZE individual
	elements, not arrays of size 1 (a revenant of an earlier API).
	All uses changed.

2020-10-11  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: remove unused code
	* src/kwsearch.c (Fcompile, Fexecute): Remove unused code.  No longer these
	are used after commit 016e590a8198009bce0e1078f6d4c7e037e2df3c.

2020-10-05  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2020-10-05  Jim Meyering  <meyering@fb.com>

	tests: correct filename-lineno.pl
	* tests/filename-lineno.pl: Remove a stray envvar
	that somehow slipped into expected output string.

2020-10-05  Paul Eggert  <eggert@cs.ucla.edu>

	tests: fix tests when PCRE is not used
	* tests/Makefile.am (TESTS_ENVIRONMENT):
	Set PATH before setting PCRE_WORKS, so that the latter test
	uses the just-built grep.
	* tests/filename-lineno.pl (invalid-re-P-paren)
	(invalid-re-P-star-paren): Adjust non-PCRE case to match
	recently-changed behavior.

	build: update gnulib submodule to latest

2020-10-03  Paul Eggert  <eggert@cs.ucla.edu>

	doc: document --include/--exclude better
	Problem reported by John Ruckstuhl (Bug#43782).
	* doc/grep.texi (File and Directory Selection):
	Document what happens if contradictory options are given,
	or if no option matches a file name.
	* doc/grep.in.1:

2020-10-01  Jim Meyering  <meyering@fb.com>

	maint: add technically-required quotes
	* configure.ac: Quote args of AC_CONFIG_AUX_DIR, AC_CONFIG_SRCDIR
	and AC_CHECK_FUNCS_ONCE.

2020-09-28  Jim Meyering  <meyering@fb.com>

	tests: restore deleted -P tests
	v3.4-almost-45-g8577dda deleted these two -P-using tests because a
	grep built without PCRE support would fail those tests. This sets
	an envvar with the equivalent of the result from the require_pcre_
	function and restores the now-guarded tests. Tested by running this:
	  ./configure --disable-perl-regexp && make check
	* tests/Makefile.am (PCRE_WORKS): Set this envvar.
	* tests/filename-lineno.pl: Restore invalid-re-P-paren and
	invalid-re-P-star-paren, now each with a guard.

2020-09-27  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.5
	* NEWS: Record release date.

	maint: avoid autoconf warnings * configure.ac (AC_HEADER_STDC): Remove.  It's been assumed for ages. * m4/pcre.m4 (gl_FUNC_PCRE): Use AS_HELP_STRING, not AC_HELP_STRING.

	build: update gnulib to latest

2020-09-26  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest

	tests: skip stack-overflow test when built with ASAN
	* tests/stack-overflow: Skip this test when the binary was built
	with ASAN, to avoid spurious failures.

2020-09-25  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	build: update gnulib submodule to latest

2020-09-24  Jim Meyering  <meyering@fb.com>

	tests: fix surrogate-pair test to work on 16-bit wchar_t systems
	* tests/surrogate-pair: Avoid new failure on systems with
	16-bit wchar_t.  Detect the condition and exit before the
	otherwise-failing tests.  Remove the now-incorrect in-loop
	test for that alternate failure mode.  This was exposed by
	testing on gcc119.fsffrance.org, a power8 AIX 7.2 system.

2020-09-23  Paul Eggert  <eggert@cs.ucla.edu>

	grep: don't assume PCRE in tests
	* tests/filename-lineno.pl: Remove invalid-re-P-paren and
	invalid-re-P-star-paren as they assume PCRE support, which
	causes a false alarm "grep: Perl matching not supported in a
	--disable-perl-regexp build" on platforms without PCRE.

	grep: pacify Sun C 5.15
	This suppresses a false alarm '"grep.c", line 720: warning:
	initializer will be sign-extended: -1'.
	* src/grep.c (uword_max): New static constant.
	(initialize_unibyte_mask): Use it.

2020-09-23  Paul Eggert  <eggert@cs.ucla.edu>
	    Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: fix more Turkish-eyes bugs
	Fix more bugs recently uncovered by Norihiro Tanaka (Bug#43577).
	* NEWS: Mention new bug report.
	* src/grep.c (ok_fold): New static var.
	(setup_ok_fold): New function.
	(fgrep_icase_charlen): Reject single-byte characters
	if they match some multibyte characters when ignoring case.
	This part of the patch is partly derived from
	<https://bugs.gnu.org/43577#14>, which means it is:
	(main): Call setup_ok_fold if ok_fold might be needed.
	* src/searchutils.c (kwsinit): With the grep.c changes,
	this code can now revert to classic 7th Edition Unix style;
	aborting would be wrong.
	* tests/turkish-eyes: Add tests for these bugs.

2020-09-23  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest
	* NEWS: Mention Bug#43577, which this fixes.

	grep: fix recently-introduced performance glitch
	* src/grep.c (main): Do not double-increment update_patterns.
	update_patterns increments n_patterns now; do not increment it
	again, as the incorrect count would hurt performance heuristics later.

2020-09-22  Paul Eggert  <eggert@cs.ucla.edu>

	doc: improve --line-buffer doc
	* doc/grep.texi (Other Options): Document --line-buffered more
	carefully, and say what happens when it is not used.  Problem
	reported by Dan Jacobson (Bug#35339).

	tests: port timeout test to Alpine
	Problem reported by Bruno Haible in:
	https://lists.gnu.org/r/grep-devel/2020-09/msg00080.html
	* tests/init.cfg (require_timeout_): Check that ‘timeout 0.01
	sleep 0.02’ works as expected, to avoid spurious test failure
	on Alpine.

2020-09-22  Jim Meyering  <meyering@fb.com>

	tests: test for many-regexp N^2 RSS regression
	* tests/many-regex-performance: New test for this performance
	regression.
	* tests/Makefile.am: Add it.
	* NEWS (Bug fixes): Describe it.

2020-09-22  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: avoid unnecessary regex compilation
	Grep resorts to using the regex engine when the precision of either
	-o or --color is required, or when the pattern is not supported by
	our DFA engine (e.g., backref). Otherwise, grep would perform regex
	compilation solely to check the syntax. This change makes grep skip
	that compilation in the common case for which it is unnecessary.

	The compilation we are avoiding is quite costly, consuming O(N^2)
	RSS for N regular expressions.

	* src/dfasearch.c (GEAcompile): Add new argument, and avoid unneeded
	compilation of regex.
	* src/grep.c (compile_fp_t): Update prototype.
	(main): Update caller.
	* src/kwsearch.c (Fcompile): Update caller and add new argument.
	* src/pcresearch.c (Pcompile): Add new argument.
	* src/search.h (GEAcompile, Fcompile, Pcompile): Update prototype.

2020-09-22  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest

	tests: skip stack-overflow test on midnightbsd*
	* tests/stack-overflow: skip_ when run on this OS. See details
	in https://lists.gnu.org/r/grep-devel/2020-09/msg00062.html
	* tests/Makefile.am (host_triplet): Export.

2020-09-21  Paul Eggert  <eggert@cs.ucla.edu>

	doc: say how to match chars by code
	From a suggestion in Bug#41004.
	* doc/grep.texi (Character Encoding, Matching Non-ASCII):
	New sections.  Move some material from Environment Variables
	into these sections.

2020-09-18  Paul Eggert  <eggert@cs.ucla.edu>

	* src/dfasearch.c (struct dfa_comp): Fix out-of-date comment.

	grep: "grep '\)'" reports an error again
	* src/grep.c (try_fgrep_pattern): With -G, pass \) through to
	GEAcompile so that it can complain.  This fixes an unexpected
	change in behavior from grep 3.4 and earlier.
	* tests/filename-lineno.pl: Add tests for this sort of thing.

	grep: tweak by using mempcpy
	* src/grep.c (try_fgrep_pattern): Tweak previous change
	by using mempcpy.

2020-09-18  Jim Meyering  <meyering@fb.com>

	grep: make echo .|grep '\.' match once again
	The same applied for many other backslash-escaped bytes, not just
	metacharacters.  The switch to rawmemchr in v3.4-almost-10-g9393b97
	made some parts of the code require the usually-guaranteed newline
	sentinel at the end of each pattern. Before, some consumers used a
	(correct) pattern length and did not care that try_fgrep_pattern could
	transform a pattern (with sentinel) like "\\.\n" to "..\n", thus
	violating that assumption.
	* src/grep.c (try_fgrep_pattern): Preserve the invariant
	that each regexp is newline-terminated.
	* tests/backslash-dot: New file. Test for this.
	* tests/Makefile.am (TESTS): Add it.

	tests: triple-backref: print a reference to glibc bug
	* tests/triple-backref (MALLOC_CHECK_): And tell glibc not to
	bother with a core dump.  Suggested by Pádraig Brady.

2020-09-18  Paul Eggert  <eggert@cs.ucla.edu>

	grep: be more consistent about diagnostic format
	* NEWS: Mention this.
	* bootstrap.conf (gnulib_modules): Remove 'quote'.
	* src/grep.c: Do not include quote.h.
	(grep, grepdirent, grepdesc): Put the three unusual diagnostics
	into the same "grep: FOO: message" form that grep uses elsewhere.
	* tests/binary-file-matches, tests/in-eq-out-infloop:
	Adjust tests to match new diagnostic format.

2020-09-17  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest

2020-09-17  Paul Eggert  <eggert@cs.ucla.edu>

	* tests/triple-backref: Add comment.

2020-09-17  Jim Meyering  <meyering@fb.com>

	tests: make new test executable, to placate distcheck
	* tests/binary-file-matches: Make this executable.

	tests: add coverage for code that emits the new diagnostic
	* tests/binary-file-matches: New file.
	* tests/Makefile.am (TESTS): Add it.

	maint: avoid syntax-check failure
	* src/grep.c (grep): Lower-case the "B" in "Binary file... matches"
	diagnostic that we now emit to stderr. This avoids the following
	when running "make syntax-check":
	  maint.mk: found capitalized error message
	  make: *** [maint.mk:469: sc_error_message_uppercase] Error 1

2020-09-17  Paul Eggert  <eggert@cs.ucla.edu>

	Send "Binary file FOO matches" to stderr
	* NEWS, doc/grep.texi: Mention this change (Bug#29668).
	* src/grep.c (grep): Send "Binary file FOO matches" to stderr
	instead of stdout.
	* tests/encoding-error, tests/invalid-multibyte-infloop:
	* tests/null-byte, tests/pcre-count, tests/surrogate-pair:
	* tests/symlink, tests/unibyte-binary:
	Adjust tests to match new behavior.  In all cases this
	simplifies the tests, which is a good sign.

	Suppress "Binary file FOO matches" if -I
	Problem reported by Jason Franklin (Bug#33552).
	* NEWS: Mention this.
	* src/grep.c (grep): Do not output "Binary file FOO matches" if -I.
	* tests/encoding-error: Add test for this bug.

2020-09-15  Jim Meyering  <meyering@fb.com>

	maint: keep two blank lines before each old Noteworthy line.
	* NEWS: Insert a blank line.

2020-09-15  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2020-09-13  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2020-09-12  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2020-09-11  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest

2020-09-09  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix logic for growing PCRE JIT stack
	* src/pcresearch.c (jit_exec) [PCRE_EXTRA_MATCH_LIMIT_RECURSION]:
	When growing the match_limit_recursion limit, do not use the old
	value if ! (flags & PCRE_EXTRA_MATCH_LIMIT_RECURSION), as it is
	uninitialized in that case.

	grep: fix PCRE JIT test when JIT not available
	Problem reported by Thomas Deutschmann (Bug#29446#23).
	* src/pcresearch.c (Pexecute): Diagnose PCRE_ERROR_RECURSIONLIMIT.
	* tests/pcre-jitstack: Treat recursion limit overflow like stack
	overflow.

	grep: fix -w bug in UTF-8 locales
	Problem reported by Mayo Fark (Bug#43225).
	* src/searchutils.c (wordchar_prev): In a UTF-8 locale, do not
	assume that an encoding-error byte cannot be part of a word
	constituent, as this assumption is incorrect for the last byte
	of a multibyte word constituent.
	* tests/word-delim-multibyte: Add a test for the bug.

	Distribute a gzip tarball again
	Requested by Issam E. Maghni in:
	https://lists.gnu.org/r/grep-devel/2020-09/msg00000.html
	* configure.ac (AM_INIT_AUTOMAKE): Remove no-dist-gzip.

	* README-prereq: Also mention xz.

2020-09-07  Paul Eggert  <eggert@cs.ucla.edu>

	Prefer rawmemchr to memchr when it’s easy
	* bootstrap.conf (gnulib_modules): Add rawmemchr.
	* src/dfasearch.c (GEAcompile, EGexecute):
	* src/grep.c (update_patterns, prpending, prtext):
	* src/kwsearch.c (Fcompile, Fexecute):
	* src/pcresearch.c (Pcompile, Pexecute):
	Simplify (and presumably speed up a little) by using rawmemchr
	with a sentinel, instead of using memchr.

	Simplify pattern_file_name
	* src/grep.c (pattern_file_name): Make first argument
	origin-0, not origin-1, as this simplifies both caller and
	callee.  All uses changed.

	Simplify regex_compile
	* src/dfasearch.c (regex_compile): "" suffices; we don’t need "\0".
	No need to initialize pat_lineno.

	Omit duplicate regexps
	Do not pass two copies of the same regexp to the
	regular-expression engine.  Although the engines should
	perform nearly as well even with the copies, in practice they do not.
	Problem reported by Luca Borzacchiello (Bug#43040).
	* bootstrap.conf (gnulib_modules): Add hash.
	* src/grep.c: Include stdint.h, for SIZE_WIDTH.
	Include hash.h.
	(struct patloc, patloc, patlocs_allocated, patlocs_used):
	Rename from struct FL_pair, fl_pair, n_fl_pair_slots, n_pattern_files,
	respectively, since the data type is no longer a pair.
	All uses changed.
	(struct patloc): New member FILELINE.  The lineno member is now
	ptrdiff_t since nowadays we prefer signed types.
	(pattern_array, patterns_table): New static vars.
	(count_nl_bytes, fl_add): Remove; no longer used.
	(hash_pattern, compare_patterns, update_patterns): New functions.
	update_patterns does what fl_add used to do, plus remove dups.
	(pattern_file_name): Adjust to change from fl_pair to patloc.
	(main): Move some variables to inner blocks for clarity.
	Maintain the pattern_table hash of all patterns.
	Update pattern_array to match keys, and use update_patterns
	instead of fl_add to remove duplicate keys.
	* tests/filename-lineno.pl (invalid-re-2-files)
	(invalid-re-2-files2, invalid-re-2e): Ensure regexps are unique in
	tests so that dups aren’t removed in diagnostics.
	(invalid-re-line-numbers): New test.

2020-08-23  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest
	* gnulib: Update submodule to latest.
	* bootstrap.conf (gnulib_modules): Add explicit dependency on dirname-lgpl.
	Before, we pulled this in via a dependency.
	* bootstrap: Update from gnulib.

	build: require autoconf-2.64
	* configure.ac: Require autoconf-2.64, up from 2.63, to align with gnulib.

2020-08-22  Paul Eggert  <eggert@cs.ucla.edu>

	Revert -L exit status change introduced in grep 3.2
	Problems reported by Antonio Diaz Diaz in:
	https://bugs.gnu.org/28105#29
	* NEWS, doc/grep.texi (Exit Status), src/grep.c (usage):
	Adjust documentation accordingly.
	* src/grep.c (grepdesc, main): Go back to old behavior.
	* tests/skip-read: Adjust tests accordingly.

2020-01-20  Paul Eggert  <eggert@cs.ucla.edu>

	tests: fix permission issue in previous change

	tests: work around GCC -fprofile-generate bug
	* tests/triple-backref: Add a 10 s timeout to work around
	what appears to be a GCC bug with -fprofile-generate.
	Problem reported by Martin Liška, with diagnosis by
	Andreas Schwab (Bug#21513).

2020-01-02  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.4
	* NEWS: Record release date.

	build: update gnulib to latest, for mbrtowc-vs-Irix build fix

2020-01-02  Paul Eggert  <eggert@cs.ucla.edu>

	doc: mention glibc bug 24269
	* doc/grep.texi (Known Bugs): Mention glibc bug 24269.
	Merge formatting/URL changes from Gnulib regex.texi.

	doc: fix --exclude description in man page
	Problem reported by Duncan Moore (Bug#37212).
	* src/grep.c (usage): Fix incorrect statement about --exclude
	and directories.  Standardize on “that match GLOB” instead
	of “matching GLOB”.

	doc: fix missing “more” in man page
	Problem reported by Philippe Schnoebelen (Bug#34078).
	* doc/grep.in.1: Add missing “more”.

2020-01-01  Paul Eggert  <eggert@cs.ucla.edu>

	doc: add [:blank:] to man page
	* doc/grep.in.1: Mention [:blank:] (Bug#33291).

2020-01-01  Jim Meyering  <meyering@fb.com>

	maint: update all copyright year number ranges
	Run "make update-copyright" and then...
	* gnulib: Update to latest with copyright year adjusted.
	* tests/init.sh: Sync with gnulib to pick up copyright year.
	* bootstrap: Likewise.
	* doc/grep.in.1: Use "-" in copyright year ranges, not \en.

2019-12-31  Jim Meyering  <meyering@fb.com>

	tests: avoid unwarranted failure in a netbsd 8.1 VM
	* tests/mb-non-UTF8-perf-Fw: Run twice, to avoid first-read penalty.
	Reported by Nelson H.F. Beebe.

2019-12-30  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest (for localeinfo perf fix)

	maint: add syntax-check rule to prohibit "backreference" spelling
	* cfg.mk (sc_prohibit_backref): New rule.

2019-12-30  Paul Eggert  <eggert@cs.ucla.edu>

	maint: remove too-long line from AUTHORS
	* AUTHORS: Remove URL that’s too long.

	maint: update AUTHORS
	* AUTHORS: Update to better reflect current authorship.

2019-12-30  Jim Meyering  <meyering@fb.com>

	avoid new syntax-check failures
	* cfg.mk (old_NEWS_hash): Updating old news, we must also udpate this.

2019-12-30  Paul Eggert  <eggert@cs.ucla.edu>

	doc: don’t encourage back-references
	* doc/grep.texi (Usage): Remove palindrome question.  Bondioni’s
	RE makes grep issue a ‘grep: stack overflow’ diagnostic, and we
	shouldn’t be encouraging fancy back-references anyway, due to all
	the bugs in this area (Bug#26864).  Plus, the allusion to
	“GNU extensions” doesn't seem to be correct here.

	doc: robustify some examples
	Prompted by suggestions by Stephane Chazelas (Bug#38792#20).
	* doc/grep.texi (Usage): Make examples more robust.

	doc: fix bug# typo

	doc: spell "back-reference" more consistently

	doc: mention back-reference bugs
	Inspired by Bug#26864.
	* doc/grep.texi (Known Bugs): New section.
	Mention back-reference issues.

2019-12-29  Paul Eggert  <eggert@cs.ucla.edu>

	doc: Add -- to more-complex example
	Suggested by Stephane Chazelas (Bug#38792).
	* doc/grep.in.1, doc/grep.texi: Add ‘--’ to recently-added example.

	doc: improve subsection title (Bug#26132)
	* doc/grep.in.1: Rename "Matcher Selection" to "Pattern Syntax".

	doc: fix typo in previous patch

	doc: document quoting better
	Problem reported by Martin Simons (Bug#38792).
	* doc/grep.texi: Fix quoting used in examples.  Say that patterns
	should be quoted, use quoting more consistently in examples, and
	give an example illustrating the difference between patterns and
	globbing.  Don’t assume zgrep expertise in example.
	* doc/grep.in.1: Likewise.  Also, reorder sections
	to match GNU/Linux man-pages style.

2019-12-26  Jim Meyering  <meyering@fb.com>

	maint: tweak NEWS wording
	* NEWS: Minor wording change.

	build: update gnulib to latest; and sync tests/init.sh
	* gnulib: update
	* tests/init.sh: Sync from gnulib (this removes the LC_ALL=C setting).

	tests: avoid spurious failure due to 1-second timeout
	* tests/grep-dev-null-out: Use a 10-second timeout, rather than
	a 1-second one.  This avoids false failure on slow systems.
	Reported by Assaf Gordon in
	https://lists.gnu.org/r/grep-devel/2019-12/msg00018.html

2019-12-26  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

	maint: adjust surrogate-pair for 16-bit wchar_t
	* tests/surrogate-pair: Adjust to match fixed behavior
	on AIX 7.2, where wchar_t is 16 bits and cannot represent
	the test case data.

2019-12-25  Jim Meyering  <meyering@fb.com>

	tests: fix typo in name of test file
	* tests/backslash-s-vs-invalid-multitype: Rename to...
	* tests/backslash-s-vs-invalid-multibyte: ...this.
	* tests/Makefile.am (TESTS): Reflect renaming.

	tests: ensure we use require_timeout_ when needed
	* cfg.mk (sc_timeout_prereq): New syntax-check rule.

	tests: require timeout
	* tests/mb-non-UTF8-perf-Fw: This test uses "timeout",
	so must first call require_timeout_.
	This avoids test spurious failure when running with
	no timeout program. Reported by Bruno Haible in
	https://lists.gnu.org/r/grep-devel/2019-12/msg00008.html

2019-12-25  Paul Eggert  <eggert@cs.ucla.edu>

	tests: work around AIX 7.2 sh printf bug
	AIX 7.2 /bin/sh’s printf command mishandles octal escapes
	in multibyte locales: it treats them as characters, not bytes.
	* tests/backslash-s-vs-invalid-multitype, tests/encoding-error:
	Use the C locale when employing the printf command with an octal
	escape that AIX 7.2 sh might mishandle.
	* tests/init.sh (setup_): Use the C locale for tests.
	This has the side benefit of making them more reproducible.

2019-12-22  Jim Meyering  <meyering@fb.com>

	maint: adjust new comments
	* src/dfasearch.c (possible_backrefs_in_pattern): Remove a
	duplicate "a", insert a "be" and a comma, and reformat.

	build: update gnulib to latest
	* gnulib: Update submodule to latest.
	* bootstrap: Copy from gnulib.
	* tests/init.sh: Likewise.

2019-12-22  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix some bugs in pattern-grouping speedup
	This fixes some bugs in the previous commit,
	and should finish the fix for Bug#33249.
	* NEWS: Mention fix for Bug#33249.
	* src/dfasearch.c (possible_backrefs_in_pattern, regex_compile)
	(GEAcompile): In new code, prefer ptrdiff_t to size_t when either
	will do, since ptrdiff_t has better error checking.  At some point
	we should adjust the old code too.
	(possible_backrefs_in_pattern): Rename from
	find_backref_in_pattern.  New arg BS_SAFE.  All uses changed.
	Fix false negative if a multibyte character ends in a single
	'\\' byte, followed by the two bytes '\\', '1'.
	(regex_compile): Simplify.
	(GEAcompile): Avoid quadratic behavior when reallocating growing
	buffers.  Fix a couple of bugs in copying pattern data involving
	backreferences.  Fix another bug in copying pattern metadata
	involving backreferences, by removing the need to copy it.

2019-12-22  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: grouping of a pattern with multiple lines
	When grep uses regex, it splits a pattern with multiple lines by
	newline character into fragments.  Compilation and execution run for
	each fragment.  That causes slowdown.  By this change, each fragment is
	divided into groups by whether the fragment includes back references.
	A fragment with back references constitutes group, and all fragments
	that lack back references also constitute a group.

	This change extremely speeds-up following case.

	  $ seq -f '%040g' 0 9999 | sed '1s/$/\\(0\\)\\1/' >pat
	  $ yes 00000000000000000000000000000000000000000x | head -10000 >in
	  $ time -p env LC_ALL=C src/grep -f pat in

	* src/dfasearch.c (find_backref_in_pattern, regex_compile):
	New functions.
	(GEAcompile): Use the new functions to group fragments
	as mentioned above.

2019-12-19  Paul Eggert  <eggert@cs.ucla.edu>

	maint: add NEWS for Bug#34951 fix
	* NEWS: Mention Bug#34951.

2019-12-19  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	dfa: separate parse and compile phase
	DFAMUST() must be called after parse and before tokens re-order which is
	introduced in commit 5c7a0371823876cca7a1347fa09ca26bbbff0c98, but both are
	executed in compilation phase.

	* lib/dfa.c (dfaparse): Change it to global function.
	(dfacomp): If first argument is NULL, skip parse.
	* lib/dfa.h: (dfaparse): Add a prototype.

2019-12-19  Paul Eggert  <eggert@cs.ucla.edu>

	build: update gnulib submodule to latest

2019-12-19  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: speed up multiple word matching
	grep uses its KWset matcher for multiple word matching, but that is
	very slow when most of the parts matched to a pattern are not words.
	So, if the first match to a pattern is not a word, use the grep matcher
	to match for its line.

	Note that when START_PTR is set, the grep matcher uses the regex matcher
	which is very slow to match words.  Therefore, we use the grep matcher
	when only START_PTR is NULL.

	* src/kwsearch.c (Fexecute): If an initial match is incomplete because
	not on a word boundary, use the grep matcher to find a matching line.

2019-12-18  Jim Meyering  <meyering@fb.com>

	maint: sort test names
	* tests/Makefile.am (TESTS): Alphabetize the new addition,
	mb-non-UTF8-perf-Fw to placate syntax-check's sc_sorted_tests.

2019-12-18  Paul Eggert  <eggert@cs.ucla.edu>

	maint: adjust to recent Gnulib change
	* po/POTFILES.in: Remove lib/xstrtol-error.c.

2019-12-17  Paul Eggert  <eggert@cs.ucla.edu>

	grep: do not match invalid UTF-8
	Update Gnulib to latest.  Also:
	* src/dfasearch.c (EGexecute): Use ptrdiff_t, not size_t,
	to match new Gnulib API.
	* tests/Makefile.am (TESTS): Add dfa-invalid-utf8.
	* tests/dfa-invalid-utf8: New file.

2019-11-30  Jim Meyering  <meyering@fb.com>

	tests: add test that would have detected -Fw perf regression
	* tests/mb-non-UTF8-perf-Fw: New file. Detect v3.3-22-g090a4db's
	performance regression.
	* tests/Makefile.am (TESTS): Add it.

2019-11-29  Jim Meyering  <meyering@fb.com>

	maint: fix test comment
	* tests/mb-non-UTF8-word-boundary: Also correct "introduced-in"
	version number in a comment here.

2019-11-25  Jim Meyering  <meyering@fb.com>

	maint: correct NEWS blurb
	* NEWS (Bug fixes): Correction: the -Fw bug was introduced
	in 2.28, not in 3.0. Reported by Paul Eggert.

2019-11-17  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	grep: improve grep -Fw performance in non-UTF8 multibyte locales
	* src/searchutils.c (mb_goback): New parameter.  All callers changed.
	* src/search.h (mb_goback): Update prototype.
	* src/kwsearch.c (Fexecute): Use mb_goback's MBCLEN to detect a
	word-boundary even more efficiently.

	grep: fix performance regression with previous patch
	* src/kwsearch.c (Fexecute): Avoid unnecessary back-up in non-UTF8
	multibyte locales.

2019-11-16  Jim Meyering  <meyering@fb.com>

	maint: rename a variable: bol -> nl
	* src/kwsearch.c (Fexecute): Change misleading name: s/bol/nl/

	build: update gnulib to latest

	maint: correct and clarify a comment
	* src/kwsearch.c (Fexecute): Logic was reversed.

	grep: avoid false -Fw match in non-UTF8 multibyte locales
	For example, this command would erroneously print its input line:
	  echo ab | LC_CTYPE=ja_JP.eucjp grep -Fw b
	This arose when the "memrchr" search for a preceding newline failed:
	in that case, MB_START was not adjusted and was initially the same
	as BEG, so wordchar_prev mistakenly returned 0.
	* src/kwsearch.c (Fexecute): Set MB_START also when there is no
	preceding newline.
	* NEWS (Bug fixes): Mention it.
	* tests/mb-non-UTF8-word-boundary: New file. Test for the bug.
	* tests/Makefile.am (TESTS): Add it.
	Reported by NIDE, Naoyuki in https://bugs.gnu.org/38223.

2019-11-08  Jim Meyering  <meyering@fb.com>

	build: update gnulib to latest
	* po/POTFILES.in: Add lib/argmatch.h.

2019-11-05  Paul Eggert  <eggert@cs.ucla.edu>

	grep: new --no-ignore-case option
	Suggested by Karl Berry and mostly implemented by Arnold Robbins
	(Bug#37907).
	* NEWS:
	* doc/grep.in.1:
	* doc/grep.texi (Matching Control):
	* src/grep.c (usage):
	Document the new option.
	* src/grep.c (NO_IGNORE_CASE_OPTION): New constant.
	(long_options, main): Support new option.

	grep: simplify previous patch
	* src/grep.c (main): Use an int rather than an enum for a local
	var, which is overkill here.

	grep: further simplify out_file handling
	* src/grep.c (print_filenames): Make this a local variable instead
	of static.  Rename it to filename_option, to avoid confusion with
	the print_filename function, and rename the enum values for the
	same reason.  All uses changed.
	(out_file): Now -1, 0, 1 to represent unknown, false, true.
	All uses changed.
	(single_command_line_arg): Remove.  This static variable’s
	function is now accomplished by a local variable ‘num_operands’.
	(grepdesc): Simplify adjustment of out_file accordingly.
	(main): Initialize out_file to -1 if not known yet.

2019-11-05  Zev Weiss  <zev@bewilderbeest.net>

	grep: simplify out_file handling
	* src/grep.c (print_filenames): New tristate enum (-H, -h, or
	neither); supplants with_filenames and no_filenames.
	(single_command_line_arg): New variable indicating if grep was run
	with a single command-line argument.
	(no_filenames): Remove variable.
	(grepdirent): Don't twiddle out_file back and forth during recursion.
	(grepdesc): Turn off out_file on 'grep -r foo nondirectory'.
	(main): Replace with_filenames and no_filenames with print_filenames.
	Enable out_file when both -r/-R and multiple arguments are given.

2019-10-12  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix ‘grep -L ... >/dev/null’ bug
	Problem reported by Adam Sampson (Bug#37716).
	* NEWS: Mention this.
	* src/grep.c (grepdesc): Don’t assume that stdout being /dev/null
	means list_files == LISTFILES_NONE.
	(main): Do not change list_files merely because stdout is /dev/null.
	* tests/skip-read: Test for this bug.

2019-10-03  Paul Eggert  <eggert@cs.ucla.edu>

	grep: tighten -i doc
	* doc/grep.in.1:
	* doc/grep.texi (Matching Control):
	* src/grep.c (usage):
	Make it clearer that -i affects patterns and data, but not
	file names (Bug#37604).

2019-03-10  Paul Eggert  <eggert@cs.ucla.edu>

	maint: fix “/src/grep: No such file or directory”
	Problem reported by Jim Meyering in:
	https://lists.gnu.org/r/grep-devel/2019-02/msg00000.html
	* NEWS: Mention the change.
	* configure.ac (fn_grep): Remove.  This old attempt to fix
	<https://savannah.gnu.org/bugs/?31646> wasn’t working anyway,
	since subprograms didn’t grok fn_grep.  People building on Solaris
	will need a working grep, which is reasonably standard nowadays.
	(GREP, EGREP): Do not override.  This way, we test the
	newly-built grep only when running ‘make test’ and suchlike.
	Instead, output a hopefully-helpful diagnostic if the
	system 'grep' does not work.

2019-02-18  Jim Meyering  <meyering@fb.com>

	tests: avoid false positive upon stack overflow
	* tests/pcre-jitstack: Don't let a stack overflow evoke a false
	failure.  This test is to ensure there is no internal PCRE error.
	Reported by Andreas Schwab in http://bugs.gnu.org/34370

2019-02-16  Jim Meyering  <meyering@fb.com>

	build: avoid build failure with --enable-gcc-warnings
	* src/kwset.c (bmexec_trans): Define with _GL_ATTRIBUTE_PURE,
	per suggestion from recent gcc snapshot.

2019-02-03  Paul Eggert  <eggert@cs.ucla.edu>

	doc: clarify --exclude globbing
	Problem reported by Paul Jackson.
	* doc/grep.in.1:
	* doc/grep.texi (File and Directory Selection):
	Clarify how --exclude globbing works.

	grep: parse --color arg independent of locale
	This is a better fix for Bug#34285.
	* bootstrap.conf (gnulib_modules): Add c-strcase.
	* src/grep.c: Include c-strcase.h, not strings.h.
	(main): Use c_strcasecmp, not strcasecmp.

2019-02-02  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fix grep.c includes
	* src/grep.c: Include strings.h; problem reported by David
	Monniaux (Bug#34285).  Do not include fcntl.h, as system.h does
	that for us.h

	build: update gnulib submodule to latest

2019-01-20  Jim Meyering  <meyering@fb.com>

	build: ensure no VLA is used
	Cause developer builds to fail for any use of a VLA.
	VLAs (variable length arrays) limit portability.
	* configure.ac (nw): Remove -Wvla from the list of disabled warnings,
	thus enabling the warning when configured with --enable-gcc-warnings.
	(GNULIB_NO_VLA) Define, disabling use of VLAs in gnulib.  This commit
	is functionally equivalent to coreutils' v8.30-44-gd26dece5d.

	build: update gnulib to latest

2019-01-20  Paul Eggert  <eggert@cs.ucla.edu>

	doc: --binary-files update in man page
	* doc/grep.in.1: Adjust --binary-files description to match that
	in doc/grep.texi.  When I updated the documentation in
	2016-09-09T01:33:14!eggert@cs.ucla.edu I forgot to update the man
	page accordingly (Bug#33898).

	grep: simplify pcresearch.c ifdefs
	This fixes a warning if PCRE is not used (Bug#34054).
	* configure.ac (USE_PCRE): New conditional.
	* src/Makefile.am (grep_SOURCES) [!USE_PCRE]: Omit pcresearch.c.
	* src/grep.c (matchers) [!HAVE_LIBPCRE]: Omit perl matcher.
	(setmatcher) [!HAVE_LIBPCRE]: If helpful, mention
	--disable-perl-regexp in diagnostic.
	* src/pcresearch.c: Simplify by assuming HAVE_LIBPCRE.

2019-01-01  Jim Meyering  <meyering@fb.com>

	maint: update all copyright dates via "make update-copyright"
	* gnulib: Also update submodule for its copyright updates.

2018-12-20  Jim Meyering  <meyering@fb.com>

	doc: fix the bug-introduced version in 3.3's announcement
	* NEWS: Correct bug-introduced version (s/2.3/3.2/).
	* cfg.mk (old_NEWS_hash): Updating old news, we must also udpate this.

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.3
	* NEWS: Record release date.

	grep: fix \b DFA-bug in C locale
	Under some conditions, \b would mistakenly fail to match, e.g.
	  echo 123-x|LC_ALL=C grep '.\bx'
	* NEWS (Bug fixes): Mention it
	* gnulib: Update to latest, for DFA regression fix.
	* tests/word-delim-multibyte: Add a test for the dfa.c regression.

2018-12-20  Paul Eggert  <eggert@cs.ucla.edu>

	grep: fit --version authorship into 80
	* src/grep.c (AUTHORS): Remove.
	(main): Output the authorship info ourselves instead of having
	version_etc do it.  This is better for i18n anyway.

	build: update gnulib submodule to latest

2018-12-20  Jim Meyering  <meyering@fb.com>

	maint: post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 3.2
	* NEWS: Record release date.

2018-12-18  Jim Meyering  <meyering@fb.com>

	build: update gnulib for c-stack fix

2018-12-17  Bruno Haible  <bruno@clisp.org>

	tests: stack-overflow: avoid unwarranted test failure on some hosts
	* tests/stack-overflow: Use ulimit to limit stack size. Otherwise,
	at least on gcc113, grep would fail to overflow its stack, so this
	test would fail to find the required diagnostic and would fail.

2018-12-16  Jim Meyering  <meyering@fb.com>
