From mboxrd@z Thu Jan 1 00:00:00 1970 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 Content-Type: multipart/mixed; boundary="===============7289991292481798936==" List-Id: --===============7289991292481798936== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable - 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 termi= nal away from the calling shell, causing it to exit. 29 There are problems with recovery after parser errors when parsing compo= und 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_sour= ce_bash.patch =09 - 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 =20 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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Bash-Release: 5.2 +Patch-ID: bash52-027 + +Bug-Reported-by: Emanuel Haupt +Bug-Reference-ID: <20221001123841.27e1bfb3bf3ed58ab32ea2b5(a)FreeBSD.org> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-10/msg00= 000.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 =3D yes; then + AC_LIBOBJ(strtoimax) + fi +--- 30,34 ---- + ]) + AC_MSG_RESULT($bash_cv_func_strtoimax) +! if test $bash_cv_func_strtoimax =3D 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_strtoi= max" >&5 + printf "%s\n" "$bash_cv_func_strtoimax" >&6; } +! if test $bash_cv_func_strtoimax =3D yes; then + case " $LIBOBJS " in + *" strtoimax.$ac_objext "* ) ;; +--- 20444,20448 ---- + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strtoi= max" >&5 + printf "%s\n" "$bash_cv_func_strtoimax" >&6; } +! if test $bash_cv_func_strtoimax =3D 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). */ + =20 +! #define PATCHLEVEL 26 + =20 + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + =20 +! #define PATCHLEVEL 27 + =20 + #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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Bash-Release: 5.2 +Patch-ID: bash52-028 + +Bug-Reported-by: Mark March +Bug-Reference-ID: <834896722.6304071.1718744118467(a)mail.yahoo.com> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2024-06/msg00= 122.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|SU= BSHELL_PIPE)) =3D=3D 0)) + give_terminal_to (pipeline_pgrp, 1); + =20 +--- 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 & (SU= BSHELL_ASYNC|SUBSHELL_PIPE)) =3D=3D 0)) + give_terminal_to (pipeline_pgrp, 1); + =20 +*** ../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). */ + =20 +! #define PATCHLEVEL 27 + =20 + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + =20 +! #define PATCHLEVEL 28 + =20 + #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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +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/msg00= 072.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 =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + =20 +--- 6471,6483 ---- + { + set_exit_status (EXECUTION_FAILURE); ++ current_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level =3D=3D 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + =20 +*************** +*** 6538,6546 **** + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + =20 +--- 6543,6555 ---- + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token =3D current_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level =3D=3D 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + =20 + +*** ../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 =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + =20 +--- 8786,8798 ---- + { + set_exit_status (EXECUTION_FAILURE); ++ current_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level =3D=3D 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + =20 +*************** +*** 8853,8861 **** + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! jump_to_top_level (DISCARD); + } + =20 +--- 8858,8870 ---- + { + set_exit_status (EXECUTION_FAILURE); +! last_read_token =3D current_token =3D '\n'; /* XXX */ + if (interactive_shell =3D=3D 0 && posixly_correct) + jump_to_top_level (FORCE_EOF); + else +! { +! if (executing && parse_and_execute_level =3D=3D 0) +! top_level_cleanup (); +! jump_to_top_level (DISCARD); +! } + } + =20 + +*** ../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). */ + =20 +! #define PATCHLEVEL 28 + =20 + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + =20 +! #define PATCHLEVEL 29 + =20 + #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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +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/msg00= 104.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) =3D=3D 0) || STOPPED (job))) + continue; +! =20 + /* 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) =3D=3D 0) || STOPPED (job))) + continue; +!=20 +! /* 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 =3D=3D 0 && DEADJOB (job) && IS_FOREGROUND (= job) =3D=3D 0 && +! WIFSIGNALED (s) && (termsig =3D=3D SIGINT +! #if defined (DONT_REPORT_SIGTERM) +! || termsig =3D=3D SIGTERM +! #endif +! #if defined (DONT_REPORT_SIGPIPE) +! || termsig =3D=3D SIGPIPE +! #endif +! || signal_is_trapped (termsig))) +! continue; +!=20 +! /* hang onto the status if the shell is running -c command */ +! else if (startup_state =3D=3D 2 && subshell_environment =3D=3D 0 && +! WIFSIGNALED (s) =3D=3D 0 && +! ((DEADJOB (job) && IS_FOREGROUND (job) =3D=3D 0) || STOPPED (job))) +! continue; +!=20 + /* 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 !=3D SIGINT) +*************** +*** 4331,4337 **** + fprintf (stderr, "\n"); + } + } +! else if (job_control) /* XXX job control test added */ + { + if (dir =3D=3D 0) + dir =3D current_working_directory (); +--- 4365,4375 ---- + fprintf (stderr, "\n"); + } ++ /* foreground jobs that exit cleanly */ ++ jobs[job]->flags |=3D J_NOTIFIED; + } +! else if (job_control) + { ++ /* background jobs with job control, interactive and ++ non-interactive shells */ + if (dir =3D=3D 0) + dir =3D current_working_directory (); +*************** +*** 4342,4346 **** + } + =20 +! jobs[job]->flags |=3D J_NOTIFIED; + break; + =20 +--- 4380,4391 ---- + } + =20 +! /* 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 =3D %d", job, jobs[job]->flags, startup_state); +! jobs[job]->flags |=3D J_NOTIFIED; +! } + break; + =20 + +*** ../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). */ + =20 +! #define PATCHLEVEL 29 + =20 + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + =20 +! #define PATCHLEVEL 30 + =20 + #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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +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/msg00= 045.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/msg00= 047.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 **** + =20 + case cm_coproc: +! cprintf ("coproc %s ", command->value.Coproc->name); + skip_this_indent++; + make_command_string_internal (command->value.Coproc->command); +--- 357,363 ---- + =20 + case cm_coproc: +! cprintf ("coproc "); +! if (command->value.Coproc->command->type !=3D 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). */ + =20 +! #define PATCHLEVEL 31 + =20 + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + =20 +! #define PATCHLEVEL 32 + =20 + #endif /* _PATCHLEVEL_H_ */ --=20 2.46.0 --===============7289991292481798936==--