* tests/write-error-msg: Do not require that a disk full
diagnostic include additional information. In some cases, there
is no valid errno value, so we cannot provide more information.
This was exposed by a patch that coincidentally caused the length
of grep's help output to be precisely 4096 bytes long.
Reported in https://bugs.gnu.org/77800
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/grep-devel/2025-04/msg00005.html
* bootstrap.conf (bootstrap_post_import_hook):
Simplify. Don’t recommend against pkg.m4 serial 12,
since the following patches port to it.
* configure.ac: Don’t fail if pkg-config is missing.
* m4/pcre.m4 (gl_FUNC_PCRE): If pkg-config works use that;
otherwise if PCRE_CFLAGS='' PCRE_LIBS='-lpcre2-8' use that;
otherwise don’t use PCRE.
* tests/mb-non-UTF8-perf-Fw: Ugh. I misread the code and
didn't even test. Given circumstances and the new timing that's
well within the 30-second timeout, I think there's no point
in trying to accommodate systems that are so overburdened they
trigger this failure. Reported by Grisha Levit.
* bootstrap.conf (gnulib_modules): Fix module name typo I introduced.
s/realloc-gnu-h/realloc-posix/. Reported by Bruno Haible in
https://bugs.gnu.org/77654
This test would hang on GNU/Hurd because the perl code we use to measure
subsecond duration isn't ported, and that loop would never terminate.
* tests/hash-collision-perf: Detect the always-0 small_ms, and skip the test.
Reported by Bruno Haible in https://bugs.gnu.org/77613
* src/grep.c (grepbuf): Handle this case: echo x|grep -l -m1 .
making it print only the file name, and not the matched line.
(main): Set out_quiet also when exit_on_match (-q) is set, so
"echo x|grep -q -m1 ." no longer prints the matched line.
* tests/max-count-overread: Add those tests, from
https://bugs.gnu.org/68989#21
* bootstrap.conf (bootstrap_post_import_hook): Add code to ensure we
do not use pkg.m4 serial 12. For the record, I've temporarily copied
the version of pkg.m4 from grep-3.11 into $(aclocal --print-ac-dir),
so that when I run bootstrap, it always gets that serial 11 version.
Reported by Bruno Haible in
https://lists.gnu.org/r/grep-devel/2025-04/msg00005.html
* src/grep.c (main): Remove vestiges of --unix-byte-offsets (-u).
In grep-3.7 (2021-08-14) it became a warning-only no-op.
Before then, it was a Windows-only no-op.
* NEWS (Changes in behavior): Mention it.
* doc/grep.in.1: Merge from groff 1.23.0 tmac/an-ext.tmac.
On Groff, fix usage neutral apostrophes;
they cannot be reliably fixed in traditional troff.
* bootstrap.conf: Some gnulib modules are now deprecated, in
favor of new names with a "-h" suffix (and stdbool->bool).
Induce this change with the following:
re='inttypes|locale|realloc-gnu|stdckdint|stddef|stdlib|string'
re="$re|sys_stat|unistd"
perl -pi -e 's{^('"$re"')$}{$1-h};s{^stdbool$}{bool}' bootstrap.conf
I misread the email thread and thought there was consensus
for the \d change, but there was wasn’t so revert the change.
Also, document the resulting confusion
somewhat better than it was documented before.
* src/pcresearch.c, tests/pcre-ascii-digits, tests-pcre-utf8-w:
Revert recent \d change, restoring the behavior to that of grep 3.11.
Treating \d differently from Perl was more trouble than it was worth.
* NEWS, doc/grep.texi (grep Programs): Document this.
* src/pcresearch.c (PCRE2_EXTRA_ASCII_BSD):
Remove. All uses removed.
* tests/pcre-ascii-digits: Adjust to this change.
* tests/pcre-utf8-w: Revert to 3.9.
* configure.ac (USE_INCLUDED_REGEX): fix condition for definition.
This doesn't affect anything right now since the value is examined
only by an unconditionally skipped test.
Problem reported by Martin Schulte <https://bugs.gnu.org/74205>.
* doc/grep.in.1, doc/grep.texi:
Use a more consistent style for [OPTION]... and [FILE]... in usage.
This doesn’t match what POSIX does but seems to be common in GNU doc.
Also, ‘...’ -> ‘@dots{}’ in grep.texi.
Problem reported by Jan Černohorský (Bug#74159).
* src/grep.c (grepbuf): If exit_on_match, set stdout_errno to
avoid screwups on buggy OSes. Also, ignore errseen since it
cannot be true here.
(main): Do not clear exit_failure if -q is given, as exit status
should be zero only if an input line is selected.
* tests/write-error-msg: Check that -q suppresses diagnostics
of output errors only if a match is found.
This is in response to a bug report by Rodrigo Jorge
<https://bugs.gnu.org/73360>.
* doc/grep.texi (File and Directory Selection):
Warn that ‘grep’ shouldn’t be used to determine whether
a file is binary for other applications’ purposes, as
their definition of “binary” may well differ.
Improve documentation for discovery of null input.
The previous code could call 'read' with a nearly unbounded size
if the input had long lines, and this unbounded size persisted
from one file to the next once the input buffer grew.
This could have bad effects on the CPU's data cache,
and also could cause 'grep' to make counterintuitive decisions as
to whether a file is binary <https://bugs.gnu.org/73360>.
Instead, pick a good read size and stick with it; this is
more consistent, and more likely to fit in a cache.
* src/grep.c (good_readsize): New static var.
(GOOD_READSIZE_MIN): Rename from INITIAL_BUFSIZE. All uses changed.
(fillbuf): Read good_readsize bytes rather than trying to
fill the rest of the input buffer.
(drain_input): Read good_readsize rather than GOOD_READSIZE_MIN
bytes.
(main): Initialize good_readsize.