bash: Update the patches applied to bash

- Update the patches to include patches 16 to 21
- Update of rootfile not required
- Changelog
	patch 21: fix for expanding command substitutions in a word expansion in a
		  here-document
	patch 20: allow time reserved word as first token in command substitution
	patch 19: fix case where background job set the terminal process group
	patch 18: fix for returning unknown tokens to the bison parser
	patch 17: fix for optimizing forks when using the . builtin in a subshell
	patch 16: fix for a crash if one of the expressions in an arithmetic for command
		  expands to NULL

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
This commit is contained in:
Adolf Belka
2023-12-18 18:28:52 +01:00
committed by Peter Müller
parent da4e2fc635
commit de1cd0d54d
7 changed files with 3918 additions and 1 deletions

View File

@@ -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 15); do \
for i in $$(seq 1 21); do \
cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/bash/bash52-$$(printf "%03d" "$${i}") || exit 1; \
done

View File

@@ -0,0 +1,47 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-016
Bug-Reported-by: F G <frank.graziano@gmail.com>
Bug-Reference-ID: <CAOhYt35M5VctK+xAPu=Gy_UzzGmHedWPJE4q+kL4UHF_6Nb1kA@mail.gmail.com>
Bug-Reference-URL:
Bug-Description:
If an expression in an arithmetic for loop expands to NULL, the shell
would crash.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/execute_cmd.c Thu Feb 23 14:15:05 2023
--- execute_cmd.c Mon Feb 27 17:53:08 2023
***************
*** 3051,3055 ****
if (l->next)
free (expr);
! new = make_word_list (make_word (temp), (WORD_LIST *)NULL);
free (temp);
--- 3051,3055 ----
if (l->next)
free (expr);
! new = make_word_list (make_word (temp ? temp : ""), (WORD_LIST *)NULL);
free (temp);
*** ../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 15
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */

View File

@@ -0,0 +1,47 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-017
Bug-Reported-by: Dan Church <h3xx@gmx.com>
Bug-Reference-ID: <1a8fd1d6-a3ac-9a67-78eb-b9a7435304c8@gmx.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-12/msg00076.html
Bug-Description:
In certain cases, using the `.' builtin in a subshell would optimize away
the rest of the commands in the subshell.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/builtins/evalfile.c 2019-07-20 16:16:08.000000000 -0400
--- builtins/evalfile.c 2022-12-22 12:13:08.000000000 -0500
***************
*** 267,271 ****
/* set the flags to be passed to parse_and_execute */
! pflags = SEVAL_RESETLINE;
pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
--- 267,271 ----
/* set the flags to be passed to parse_and_execute */
! pflags = SEVAL_RESETLINE|SEVAL_NOOPTIMIZE;
pflags |= (flags & FEVAL_HISTORY) ? 0 : SEVAL_NOHIST;
*** ../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 16
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 17
#endif /* _PATCHLEVEL_H_ */

3643
src/patches/bash/bash52-018 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-019
Bug-Reported-by: Steffen Nurpmeso <steffen@sdaoden.eu>
Bug-Reference-ID: <20230116233547.2jFxL%steffen@sdaoden.eu>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-01/msg00057.html
Bug-Description:
There are some cases where the shell reaped a background (asynchronous) job
and would incorrectly try to set the terminal's process group back to the
shell's. In these cases it never set the terminal process group to that
jobs's process group initially, so resetting it is incorrect.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/jobs.c 2022-12-13 12:09:02.000000000 -0500
--- jobs.c 2023-10-26 12:12:10.000000000 -0400
***************
*** 3078,3084 ****
subshell. Make sure subst.c:command_substitute uses the same
conditions to determine whether or not it should undo this and
! give the terminal to pipeline_pgrp. */
!
if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
(subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
give_terminal_to (shell_pgrp, 0);
--- 3036,3046 ----
subshell. Make sure subst.c:command_substitute uses the same
conditions to determine whether or not it should undo this and
! give the terminal to pipeline_pgrp. We don't give the terminal
! back to shell_pgrp if an async job in the background exits because
! we never gave it to that job in the first place. An async job in
! the foreground is one we started in the background and foregrounded
! with `fg', and gave it the terminal. */
if ((flags & JWAIT_NOTERM) == 0 && running_in_background == 0 &&
+ (job == NO_JOB || IS_ASYNC (job) == 0 || IS_FOREGROUND (job)) &&
(subshell_environment & (SUBSHELL_ASYNC|SUBSHELL_PIPE)) == 0)
give_terminal_to (shell_pgrp, 0);
***************
*** 3624,3627 ****
--- 3599,3603 ----
get_tty_state ();
save_stty = shell_tty_info;
+ jobs[job]->flags &= ~J_ASYNC; /* no longer async */
/* Give the terminal to this job. */
if (IS_JOBCONTROL (job))
*** ../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 18
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 19
#endif /* _PATCHLEVEL_H_ */

View File

@@ -0,0 +1,53 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-020
Bug-Reported-by: Dima Korobskiy <dkroot2@gmail.com>
Bug-Reference-ID: <16664c2d-40ec-df33-b932-83db06e39a82@gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00125.html
Bug-Description:
The parser did not allow `time' to appear as the first reserved word in a
command substitution.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/parse.y Tue Dec 13 12:53:21 2022
--- parse.y Fri Sep 1 10:36:28 2023
***************
*** 3151,3154 ****
--- 3151,3155 ----
case TIMEOPT: /* time -p time pipeline */
case TIMEIGN: /* time -p -- ... */
+ case DOLPAREN:
return 1;
default:
*** ../bash-5.2-patched/y.tab.c Tue Dec 13 12:53:21 2022
--- y.tab.c Fri Sep 1 10:36:44 2023
***************
*** 5466,5469 ****
--- 5466,5470 ----
case TIMEOPT: /* time -p time pipeline */
case TIMEIGN: /* time -p -- ... */
+ case DOLPAREN:
return 1;
default:
*** ../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 19
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 20
#endif /* _PATCHLEVEL_H_ */

View File

@@ -0,0 +1,61 @@
BASH PATCH REPORT
=================
Bash-Release: 5.2
Patch-ID: bash52-021
Bug-Reported-by: Norbert Lange <nolange79@gmail.com>
Bug-Reference-ID: <CADYdroPZFdVZSL6KkhqkAPgKKopbsLQVSm7_TvLCwadL2=UAWw@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-12/msg00046.html
Bug-Description:
There is an off-by-one error that causes command substitutions to fail when
they appear in a word expansion inside a here-document.
Patch (apply with `patch -p0'):
*** ../bash-5.2-patched/subst.c 2022-12-13 12:08:58.000000000 -0500
--- subst.c 2022-12-14 09:09:53.000000000 -0500
***************
*** 1694,1698 ****
CHECK_STRING_OVERRUN (i, si, slen, c);
! tlen = si - i - 1;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
--- 1699,1703 ----
CHECK_STRING_OVERRUN (i, si, slen, c);
! tlen = si - i - 2;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
***************
*** 1714,1718 ****
CHECK_STRING_OVERRUN (i, si, slen, c);
! tlen = si - i - 1;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
--- 1719,1723 ----
CHECK_STRING_OVERRUN (i, si, slen, c);
! tlen = si - i - 2;
RESIZE_MALLOCED_BUFFER (result, result_index, tlen + 4, result_size, 64);
result[result_index++] = c;
*** ../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 20
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 21
#endif /* _PATCHLEVEL_H_ */