Using --debug after -f on the command line would deref uninitialized
memory usually evoking a segfault.
* sed/compile.c (next_cmd_entry): Zero-initialize the struct.
* sed/debug.c (debug_print_function): Print only when label_name
is non-NULL.
* testsuite/debug-label.sh: New test.
* testsuite/local.mk (T): Add it.
Reported in https://debbugs.gnu.org/70232
* doc/sed.texi (BRE syntax): Note that --posix disables this GNU
extension, and clarify that in ERE mode ** is not a GNU extension.
Reported in https://debbugs.gnu.org/70476
* sed/regexp.c (compile_regex_1): Clear RE_CONTEXT_INVALID_DUP for
BRE, to accept ** as a GNU extension. In --posix mode, restore
RE_CONTEXT_INVALID_DUP for BRE to enforce strict POSIX behavior.
* NEWS: Mention this bug fix.
* testsuite/bre-star-star.sh: New test.
* testsuite/local.mk (T): Add it.
Reported in https://debbugs.gnu.org/70476
* sed/compile.c: Remove cases for 'L' command.
* testsuite/compile-errors.sh: remove test for 'L' command in posix
mode. The 'L' command was removed in version 4.3, but was still allowed
by the compiler (resulting in an internal error when running a script
that uses it). Reported in https://bugs.gnu.org/80704
Before, it would print this:
$ echo | sed L1
sed: INTERNAL ERROR: Bad cmd L
Now, it prints this:
sed: -e expression #1, char 1: unknown command: 'L'
* sed/execute.c (line_reset): Also free buf->text when buf->alloc is zero.
* testsuite/bug80573.sh: New file.
* testsuite/local.mk (T): Add it to the list.
Demonstrate via this:
echo | valgrind --leak-check=full sed/sed -e x -e 's/.*/echo hi/e' 2>&1 | grep -A5 'definitely lost'
Reported in https://bugs.gnu.org/80573
As a GNU extension, "\c[" in a regexp matches the ESC character
(i.e., control-[). Yet 's/\c[//' was rejected because "[" was treated
as the beginning of a bracket expression.
* sed/compile.c (match_slash): When matching "slash"es, treat \c as
an escape sequence, so that s/\c[// no longer fails because it
misinterprets [ as a bracket-group start.
* testsuite/misc.pl (bug79519_1,2,3,fail): Add tests.
* NEWS (Bug fixes): Mention it.
Reported by Michael Ludwig in https://bugs.gnu.org/79519.
* sed/compile.c (match_slash): Convert regex parameter from int to bool
since all callers use true or false. Add s_command parameter and warn
about nonportable backslashes when true.
(compile_address, compile_program): Update calls to match_slash.
* testsuite/posix-backslash-warn.sh: New test.
* testsuite/local.mk (T): Add it.
* NEWS: Mention the change.
* doc/sed.texi (multiple sed commands): Mention that e, r, R, w and W
are like the a, c and i commands, in that one cannot terminate such
commands with a semicolon.
* bootstrap.conf: Gnulib's stdckdint and stdbool modules are
deprecated, in favor of stdckdint-h and bool.
Induce this change with the following:
perl -pi -e 's{^stdckdint$}{$1-h};s{^stdbool$}{bool}' bootstrap.conf
And sort the resulting list of module names.
* sed/sed.c: Spell as <getopt.h> and hoist it to be with other system
header includes. Also, use "", not <> for "selinux/selinux.h".
* testsuite/test-mbrtowc.c: Same, for <error.h>.
* sed/utils.c (ck_rename): When diagnosting rename failure,
also mention the target file name.
* testsuite/in-place-suffix-backup.sh: Adjust test expectations
to match.
Reported by Sebastian Carlos in https://bugs.gnu.org/63833