modify way bash avoids running traps in subshells that haven't reset the trap strings yet; new readline bindable command 'shell-expand-and-requote-line'

This commit is contained in:
Chet Ramey
2026-01-14 11:08:22 -05:00
parent e7c3acf108
commit a6421d8419
13 changed files with 194 additions and 50 deletions
+3 -7
View File
@@ -1,6 +1,6 @@
/* execute_cmd.c -- Execute a COMMAND structure. */
/* Copyright (C) 1987-2025 Free Software Foundation, Inc.
/* Copyright (C) 1987-2026 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -1680,13 +1680,13 @@ execute_in_subshell (COMMAND *command, int asynchronous, int pipe_in, int pipe_o
if (user_subshell)
{
subshell_environment = SUBSHELL_PAREN; /* XXX */
subshell_environment = SUBSHELL_PAREN|SUBSHELL_IGNTRAP; /* XXX */
if (asynchronous)
subshell_environment |= SUBSHELL_ASYNC;
}
else
{
subshell_environment = 0; /* XXX */
subshell_environment = SUBSHELL_IGNTRAP; /* XXX */
if (asynchronous)
subshell_environment |= SUBSHELL_ASYNC;
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
@@ -1695,10 +1695,6 @@ execute_in_subshell (COMMAND *command, int asynchronous, int pipe_in, int pipe_o
subshell_environment |= SUBSHELL_COPROC;
}
/* clear the exit trap before checking for fatal signals, but don't free
the trap command (see below). */
clear_exit_trap (0);
QUIT;
CHECK_TERMSIG;