sed: do not allow removed 'L' command in compiler

* 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'
This commit is contained in:
Ash Roberts authored and Jim Meyering committed 2026-04-10 18:57:01 -07:00
1 parent 4c067b6836
commit 47838d29e1
2 files changed
+2 -3

No files matched your search

+1 -2
View File
@@ -972,7 +972,7 @@ compile_program (struct vector *vector)
if (posixicity == POSIXLY_BASIC)
switch (ch)
{
case 'e': case 'F': case 'v': case 'z': case 'L':
case 'e': case 'F': case 'v': case 'z':
case 'Q': case 'T': case 'R': case 'W':
bad_prog ("unknown command: '%c'", ch);
FALLTHROUGH;
@@ -1093,7 +1093,6 @@ compile_program (struct vector *vector)
bad_prog ("command only uses one address");
FALLTHROUGH;
case 'L':
case 'l':
ch = in_nonblank ();
if (ISDIGIT (ch) && posixicity != POSIXLY_BASIC)
+1 -1
View File
@@ -101,7 +101,7 @@ compare_ exp-bad-bang err-bad-bang || fail=1
#
# GNU extension commands, not accepted in --posix mode
# (bad_command(OPT))
for opt in e F v z L Q T R W ;
for opt in e F v z Q T R W ;
do
cat <<EOF >exp-posix-cmd-$opt || framework_failure_
sed: -e expression #1, char 2: unknown command: '$opt'