From patchwork Tue Aug 13 16:19:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7990 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4WjxS92K29z3wwl for ; Tue, 13 Aug 2024 16:20:09 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4WjxS862C6z10m; Tue, 13 Aug 2024 16:20:08 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4WjxS85RsTz3441; Tue, 13 Aug 2024 16:20:08 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4WjxS65BqPz33Gg for ; Tue, 13 Aug 2024 16:20:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4WjxS61Z5Kz10m; Tue, 13 Aug 2024 16:20:06 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1723566006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Fmp9k3UUq4OIMaGthSVUypcbC+DbXIwN4UMbwPNQPPU=; b=S1L6NJXgSsDBTm/pDaAU1x5PxJdR3OjFZBiLGMiHMuwu1IhhvHVMvQ5hHlCQjCpv0m9tJf SscauxYoOxSe2nAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1723566006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Fmp9k3UUq4OIMaGthSVUypcbC+DbXIwN4UMbwPNQPPU=; b=HxZ45B+5Ynj/iHe7jnELIyXz3tSqX0lgaMxxee6erCr/cHBUdB4m34TI8G34oLoM/6WFV6 zLqVx3PrGvnls0IDGGMtQiSznZnC/dUzVHVva5JMXN+pZXJ28PDvDGlwWSKT9VNNfasltr REBRWdDpj8FG3UNgz3th8VsTNCKnLZE+z6Dmigk0ymCF+L5S/DA0KRSg0CGfYLAxqk6fu5 lJuB4W6BokaZDW3eR4FjjLBByN1/k+KDTP19SpR3qtn1llfxhRvySjFd0XxSxCteWgIpI1 8i+BzYHRoXA6u5kPxFip2s0+amQfP1R2TBiXnUwwsBkvPya3Krxwp6g3jJDuQw== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] bash: Update to include patches 27 to 32 Date: Tue, 13 Aug 2024 18:19:36 +0200 Message-ID: <20240813162000.1113995-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: JLBG6HKVMISD2O5JTGTWYSL4YULH5WZ2 X-Message-ID-Hash: JLBG6HKVMISD2O5JTGTWYSL4YULH5WZ2 X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - Update from patches 1-26 to 1-32 - Update of rootfile not required - Changelog of patches 27 The configure test for the presence of strtoimax(3) is inverted. 28 A DEBUG trap in an asynchronous process can steal the controlling terminal away from the calling shell, causing it to exit. 29 There are problems with recovery after parser errors when parsing compound assignments. For instance, the `local' builtin reports an error but never cleans up the function context. 30 `wait -n' can fail to return some jobs if they exit due to signals the shell does not report to the user. 31 There is a memory leak in the code that implements the optimized $( --- lfs/bash | 2 +- src/patches/bash/bash52-027 | 63 +++++++++++++++++ src/patches/bash/bash52-028 | 49 +++++++++++++ src/patches/bash/bash52-029 | 137 ++++++++++++++++++++++++++++++++++++ src/patches/bash/bash52-030 | 130 ++++++++++++++++++++++++++++++++++ src/patches/bash/bash52-031 | 46 ++++++++++++ src/patches/bash/bash52-032 | 51 ++++++++++++++ 7 files changed, 477 insertions(+), 1 deletion(-) create mode 100644 src/patches/bash/bash52-027 create mode 100644 src/patches/bash/bash52-028 create mode 100644 src/patches/bash/bash52-029 create mode 100644 src/patches/bash/bash52-030 create mode 100644 src/patches/bash/bash52-031 create mode 100644 src/patches/bash/bash52-032 diff --git a/lfs/bash b/lfs/bash index c66f6a8e1..f3948c7e5 100644 --- a/lfs/bash +++ b/lfs/bash @@ -91,7 +91,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bash/bash-4.0-profile-1.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bash/bash-3.2-ssh_source_bash.patch - for i in $$(seq 1 26); do \ + for i in $$(seq 1 32); do \ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/bash/bash52-$$(printf "%03d" "$${i}") || exit 1; \ done diff --git a/src/patches/bash/bash52-027 b/src/patches/bash/bash52-027 new file mode 100644 index 000000000..9f18676f8 --- /dev/null +++ b/src/patches/bash/bash52-027 @@ -0,0 +1,63 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-027 + +Bug-Reported-by: Emanuel Haupt +Bug-Reference-ID: <20221001123841.27e1bfb3bf3ed58ab32ea2b5@FreeBSD.org> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00000.html + +Bug-Description: + +The configure test for the presence of strtoimax(3) is inverted. + +Patch (apply with `patch -p0'): + + +*** ../bash-5.2-patched/m4/strtoimax.m4 Mon Apr 11 16:31:52 2022 +--- m4/strtoimax.m4 Tue Apr 9 11:12:36 2024 +*************** +*** 30,34 **** + ]) + AC_MSG_RESULT($bash_cv_func_strtoimax) +! if test $bash_cv_func_strtoimax = yes; then + AC_LIBOBJ(strtoimax) + fi +--- 30,34 ---- + ]) + AC_MSG_RESULT($bash_cv_func_strtoimax) +! if test $bash_cv_func_strtoimax = no; then + AC_LIBOBJ(strtoimax) + fi +*** ..//bash-5.2-patched/configure Fri Sep 23 10:13:22 2022 +--- configure Tue Apr 9 11:13:21 2024 +*************** +*** 20444,20448 **** + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strtoimax" >&5 + printf "%s\n" "$bash_cv_func_strtoimax" >&6; } +! if test $bash_cv_func_strtoimax = yes; then + case " $LIBOBJS " in + *" strtoimax.$ac_objext "* ) ;; +--- 20444,20448 ---- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strtoimax" >&5 + printf "%s\n" "$bash_cv_func_strtoimax" >&6; } +! if test $bash_cv_func_strtoimax = no; then + case " $LIBOBJS " in + *" strtoimax.$ac_objext "* ) ;; + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 26 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 27 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/src/patches/bash/bash52-028 b/src/patches/bash/bash52-028 new file mode 100644 index 000000000..806bdc5ee --- /dev/null +++ b/src/patches/bash/bash52-028 @@ -0,0 +1,49 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-028 + +Bug-Reported-by: Mark March +Bug-Reference-ID: <834896722.6304071.1718744118467@mail.yahoo.com> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2024-06/msg00122.html + +Bug-Description: + +A DEBUG trap in an asynchronous process can steal the controlling terminal +away from the calling shell, causing it to exit. + +Patch (apply with `patch -p0'): + +*** ../bash-20240609/trap.c Fri May 3 12:12:38 2024 +--- trap.c Wed Jun 26 10:41:40 2024 +*************** +*** 1217,1221 **** + restore_pgrp_pipe (save_pipe); + # endif +! if (pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)) + give_terminal_to (pipeline_pgrp, 1); + +--- 1217,1223 ---- + restore_pgrp_pipe (save_pipe); + # endif +! /* If the trap command gave the terminal to another process group, +! restore it. XXX - check running_in_background? */ +! if (job_control && pipeline_pgrp > 0 && ((subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)) + give_terminal_to (pipeline_pgrp, 1); + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 27 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 28 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/src/patches/bash/bash52-029 b/src/patches/bash/bash52-029 new file mode 100644 index 000000000..7c816eaa2 --- /dev/null +++ b/src/patches/bash/bash52-029 @@ -0,0 +1,137 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-029 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-04/msg00072.html + +Bug-Description: + +There are problems with recovery after parser errors when parsing compound +assignments. For instance, the `local' builtin reports an error but never +cleans up the function context. + +Patch (apply with `patch -p0'): + +*** ../bash-20230427/parse.y Fri Apr 14 11:50:29 2023 +--- parse.y Mon May 1 16:25:14 2023 +*************** +*** 6471,6478 **** + { + set_exit_status (EXECUTION_FAILURE); + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + +--- 6471,6483 ---- + { + set_exit_status (EXECUTION_FAILURE); ++ current_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level == 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + +*************** +*** 6538,6546 **** + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + +--- 6543,6555 ---- + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token = current_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level == 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + + +*** ../bash-20230427/y.tab.c Tue Jul 30 15:19:31 2024 +--- y.tab.c Tue Jul 30 15:20:21 2024 +*************** +*** 8786,8793 **** + { + set_exit_status (EXECUTION_FAILURE); + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + +--- 8786,8798 ---- + { + set_exit_status (EXECUTION_FAILURE); ++ current_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level == 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + +*************** +*** 8853,8861 **** + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + +--- 8858,8870 ---- + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token = current_token = '\n'; /* XXX */ + if (interactive_shell == 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level == 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 28 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 29 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/src/patches/bash/bash52-030 b/src/patches/bash/bash52-030 new file mode 100644 index 000000000..20b8f244c --- /dev/null +++ b/src/patches/bash/bash52-030 @@ -0,0 +1,130 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-030 + +Bug-Reported-by: Steven Pelley +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2024-01/msg00104.html + +Bug-Description: + +`wait -n' can fail to return some jobs if they exit due to signals the shell +does not report to the user. + +Patch (apply with `patch -p0'): + +*** ../bash-5.2-patched/jobs.c Thu Nov 9 14:59:14 2023 +--- jobs.c Tue Jul 30 15:27:44 2024 +*************** +*** 4275,4279 **** + ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job))) + continue; +! + /* If job control is disabled, don't print the status messages. + Mark dead jobs as notified so that they get cleaned up. If +--- 4288,4312 ---- + ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job))) + continue; +! +! /* Do the same thing and don't print anything or mark as notified +! for the signals we're not going to report on. This is the opposite +! of the first two cases under case JDEAD below. */ +! else if (interactive_shell == 0 && DEADJOB (job) && IS_FOREGROUND (job) == 0 && +! WIFSIGNALED (s) && (termsig == SIGINT +! #if defined (DONT_REPORT_SIGTERM) +! || termsig == SIGTERM +! #endif +! #if defined (DONT_REPORT_SIGPIPE) +! || termsig == SIGPIPE +! #endif +! || signal_is_trapped (termsig))) +! continue; +! +! /* hang onto the status if the shell is running -c command */ +! else if (startup_state == 2 && subshell_environment == 0 && +! WIFSIGNALED (s) == 0 && +! ((DEADJOB (job) && IS_FOREGROUND (job) == 0) || STOPPED (job))) +! continue; +! + /* If job control is disabled, don't print the status messages. + Mark dead jobs as notified so that they get cleaned up. If +*************** +*** 4298,4302 **** + /* Print info on jobs that are running in the background, + and on foreground jobs that were killed by anything +! except SIGINT (and possibly SIGPIPE). */ + switch (JOBSTATE (job)) + { +--- 4331,4335 ---- + /* Print info on jobs that are running in the background, + and on foreground jobs that were killed by anything +! except SIGINT (and possibly SIGTERM and SIGPIPE). */ + switch (JOBSTATE (job)) + { +*************** +*** 4318,4321 **** +--- 4351,4355 ---- + else if (IS_FOREGROUND (job)) + { ++ /* foreground jobs, interactive and non-interactive shells */ + #if !defined (DONT_REPORT_SIGPIPE) + if (termsig && WIFSIGNALED (s) && termsig != SIGINT) +*************** +*** 4331,4337 **** + fprintf (stderr, "\n"); + } + } +! else if (job_control) /* XXX job control test added */ + { + if (dir == 0) + dir = current_working_directory (); +--- 4365,4375 ---- + fprintf (stderr, "\n"); + } ++ /* foreground jobs that exit cleanly */ ++ jobs[job]->flags |= J_NOTIFIED; + } +! else if (job_control) + { ++ /* background jobs with job control, interactive and ++ non-interactive shells */ + if (dir == 0) + dir = current_working_directory (); +*************** +*** 4342,4346 **** + } + +! jobs[job]->flags |= J_NOTIFIED; + break; + +--- 4380,4391 ---- + } + +! /* Interactive shells without job control enabled are handled +! above. */ +! /* XXX - this is a catch-all in case we missed a state */ +! else +! { +! internal_debug("notify_of_job_status: catch-all setting J_NOTIFIED on job %d (%d), startup state = %d", job, jobs[job]->flags, startup_state); +! jobs[job]->flags |= J_NOTIFIED; +! } + break; + + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 29 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 30 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/src/patches/bash/bash52-031 b/src/patches/bash/bash52-031 new file mode 100644 index 000000000..0210bb278 --- /dev/null +++ b/src/patches/bash/bash52-031 @@ -0,0 +1,46 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-031 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-06/msg00045.html + +Bug-Description: + +There is a memory leak in the code that implements the optimized $( +Bug-Reference-ID: Mon, 11 Dec 2023 20:41:58 +0600 +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-12/msg00047.html + +Bug-Description: + +Patch (apply with `patch -p0'): + +When printing functions containing coprocesses, the displayed coproc command +has the word COPROC inserted unconditionally, resulting in function bodies +that cannot be re-read as input. + +*** ../bash-5.2-patched/print_cmd.c Mon Aug 21 16:09:44 2023 +--- print_cmd.c Mon Dec 11 15:34:30 2023 +*************** +*** 357,361 **** + + case cm_coproc: +! cprintf ("coproc %s ", command->value.Coproc->name); + skip_this_indent++; + make_command_string_internal (command->value.Coproc->command); +--- 357,363 ---- + + case cm_coproc: +! cprintf ("coproc "); +! if (command->value.Coproc->command->type != cm_simple) +! cprintf ("%s ", command->value.Coproc->name); + skip_this_indent++; + make_command_string_internal (command->value.Coproc->command); + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 31 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 32 + + #endif /* _PATCHLEVEL_H_ */