bash: Update to include patches 27 to 32

Message ID 20240813162000.1113995-1-adolf.belka@ipfire.org
State Staged
Commit bebbb0423dcc0b47311351c9498f05a6ce513315
Headers
Series bash: Update to include patches 27 to 32 |

Commit Message

Adolf Belka Aug. 13, 2024, 4:19 p.m. UTC
  - 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 $(<file)
	expansion for some code paths.
   32	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.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 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
  

Patch

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 <ehaupt@FreeBSD.org>
+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 <march@systempad.cloud>
+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 <grishalevit@gmail.com>
+Bug-Reference-ID:	<CAMu=Brp9QHvLh8vbY45hRgCVaQUNSnU7n8EVjsWKajT7c99K8Q@mail.gmail.com>
+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 <stevenpelley@gmail.com>
+Bug-Reference-ID:	<CAGOYURh6CKaE-D0Z8puP-tQknavCQNRHo02vpvgMQqaTG3_cRw@mail.gmail.com>
+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 <grishalevit@gmail.com>
+Bug-Reference-ID:	<CAMu=BrrD52xxF7C9Ke1fosAurHq1kz82t7FcHsrPBw9CbAst6A@mail.gmail.com>
+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 $(<file)
+expansion for some code paths.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-5.2-patched/builtins/evalstring.c	Tue Dec 13 12:53:21 2022
+--- builtins/evalstring.c	Tue Nov 28 17:25:39 2023
+***************
+*** 763,766 ****
+--- 773,779 ----
+    if (fnp)
+      *fnp = fn;
++   else
++     free (fn);
++ 
+    return fd;
+  }
+
+*** ../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 30
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 31
+  
+  #endif /* _PATCHLEVEL_H_ */
+
diff --git a/src/patches/bash/bash52-032 b/src/patches/bash/bash52-032
new file mode 100644
index 000000000..618a37fca
--- /dev/null
+++ b/src/patches/bash/bash52-032
@@ -0,0 +1,51 @@ 
+			     BASH PATCH REPORT
+			     =================
+
+Bash-Release:	5.2
+Patch-ID:	bash52-032
+
+Bug-Reported-by:	Albert Akchurin <ackbeat@gmail.com>
+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_ */