diff --git a/backport-documentation-updates-for-arithmetic-expansion-and-a.patch b/backport-documentation-updates-for-arithmetic-expansion-and-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..6fb505005f4e34d7d9cb2d3c61c5cbb45f5c381e --- /dev/null +++ b/backport-documentation-updates-for-arithmetic-expansion-and-a.patch @@ -0,0 +1,59 @@ +From c3997d51f8ba359eeabb45b90b9cdae4fe599b5a Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 7 Mar 2025 10:23:58 -0500 +Subject: [PATCH] documentation updates for arithmetic expansion and array + subscripts; update BASH_COMMAND for subshells; fix potential file descriptor + leak in here document pipes + +--- + execute_cmd.c | 8 + + redir.c | 7 +- + 2 files changed, 14 insertions(+), 1 deletions(-) + +diff --git a/execute_cmd.c b/execute_cmd.c +index 03931c6c..6b2b20cf 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -776,6 +776,14 @@ execute_command_internal (COMMAND *command, int asynchronous, int pipe_in, int p + + if (user_subshell && ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS) + { ++ /* Update BASH_COMMAND before running any traps, ++ including the exit trap, since we are going to exit ++ the shell. */ ++ if (signal_in_progress (DEBUG_TRAP) == 0 && running_trap == 0) ++ { ++ FREE (the_printed_command_except_trap); ++ the_printed_command_except_trap = savestring (the_printed_command); ++ } + run_pending_traps (); + jump_to_top_level (ERREXIT); + } +diff --git a/redir.c b/redir.c +index 98137492..918e878d 100644 +--- a/redir.c ++++ b/redir.c +@@ -465,7 +465,11 @@ here_document_to_fd (WORD_DESC *redirectee, enum r_instruction ri) + + #if defined (F_GETPIPE_SZ) + if (fcntl (herepipe[1], F_GETPIPE_SZ, 0) < document_len) +- goto use_tempfile; ++ { ++ close (herepipe[0]); ++ close (herepipe[1]); ++ goto use_tempfile; ++ } + #endif + + r = heredoc_write (herepipe[1], document, document_len); +@@ -484,6 +488,7 @@ here_document_to_fd (WORD_DESC *redirectee, enum r_instruction ri) + + use_tempfile: + ++ /* TAG: use anonfiles here in a future version. */ + fd = sh_mktmpfd ("sh-thd", MT_USERANDOM|MT_USETMPDIR, &filename); + + /* If we failed for some reason other than the file existing, abort */ +-- +2.43.0 + diff --git a/backport-revert-change-that-suppressed-array-subscript-expans.patch b/backport-revert-change-that-suppressed-array-subscript-expans.patch new file mode 100644 index 0000000000000000000000000000000000000000..7810d0b5e390e375d1e7a4b3ed8ca9123fa782bc --- /dev/null +++ b/backport-revert-change-that-suppressed-array-subscript-expans.patch @@ -0,0 +1,27 @@ +From e608233770b0ba5fe20cb46842992b64f7252383 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Mon, 24 Feb 2025 11:36:49 -0500 +Subject: [PATCH] revert change that suppressed array subscript expansion when + called by the let builtin; fix default file descriptor for <> redirection + when printing command + +--- + print_cmd.c | 2 +- + 1 file changed, 1 insertions(+), 1 deletions(-) + +diff --git a/print_cmd.c b/print_cmd.c +index e7021338..2ad4b8ef 100644 +--- a/print_cmd.c ++++ b/print_cmd.c +@@ -1199,7 +1199,7 @@ print_redirection (REDIRECT *redirect) + case r_input_output: + if (redirect->rflags & REDIR_VARASSIGN) + cprintf ("{%s}", redir_word->word); +- else if (redirector != 1) ++ else if (redirector != 0) + cprintf ("%d", redirector); + cprintf ("<> %s", redirectee->word); + break; +-- +2.43.0 + diff --git a/bash.spec b/bash.spec index 6dfdb39caa73565e8ae86c6450be97beb489b2bf..5950f2f52041fc347d55ac2722a94e6f1d602ca7 100644 --- a/bash.spec +++ b/bash.spec @@ -2,7 +2,7 @@ Name: bash Version: 5.2.37 -Release: 4 +Release: 5 Summary: It is the Bourne Again Shell License: GPL-3.0-or-later URL: https://www.gnu.org/software/bash @@ -37,6 +37,8 @@ Patch6007: backport-renamed-several-functions-beginning-with-legal_-chan.patch Patch6008: backport-fix-for-cd-when-curent-directory-doesn-t-exist-fix-w.patch Patch6009: backport-posix-change-for-undoing-redirections-after-failed-e.patch Patch6010: backport-fix-issue-with-failed-history-expansion-changing-the.patch +Patch6011: backport-revert-change-that-suppressed-array-subscript-expans.patch +Patch6012: backport-documentation-updates-for-arithmetic-expansion-and-a.patch %if %{enable_safecheck} Patch9000: only-scripts-verified-by-execveat-are-allowed-to-run.patch @@ -169,6 +171,12 @@ make check %exclude %{_infodir}/dir %changelog +* Thu Jun 12 2025 yixiangzhike - 5.2.37-5 +- sync patches from bash community: + fix default file descriptor for <> redirection when printing command + update BASH_COMMAND for subshells + fix potential file descriptor leak in here document pipes + * Mon Mar 31 2025 Linux_zhang - 5.2.37-4 - sync patches from bash community