Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/bash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=bash
PKG_VERSION:=5.3
PKG_RELEASE:=2
PKG_RELEASE:=3

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/bash
Expand Down
27 changes: 27 additions & 0 deletions utils/bash/patches/009-bash_5.3_patch_10.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From d129c77127233051b8235cbec0cff1d6bea1f5f1 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 3 Jun 2026 10:19:04 -0400
Subject: Bash-5.3 patch 10: fix loop in subshells calling wait builtin with
inherited job list

--- a/jobs.c
+++ b/jobs.c
@@ -2839,7 +2839,7 @@ wait_for_background_pids (struct procsta
ps->pid = pid;
ps->status = (r < 0 || r > 256) ? 127 : r;
}
- if (r == -1 && errno == ECHILD)
+ if ((r < 0 || r > 256) && errno == ECHILD)
{
/* If we're mistaken about job state, compensate. */
check_async = 0;
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */

-#define PATCHLEVEL 9
+#define PATCHLEVEL 10

#endif /* _PATCHLEVEL_H_ */
45 changes: 45 additions & 0 deletions utils/bash/patches/010-bash_5.3_patch_11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From eb9d01914bb2320faaa8bad68859da449884744c Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 3 Jun 2026 10:20:22 -0400
Subject: Bash-5.3 patch 11: fix mapfile problem when callback unsets the
variable it is modifying

--- a/builtins/mapfile.def
+++ b/builtins/mapfile.def
@@ -153,9 +153,7 @@ mapfile (int fd, long line_count_goal, l
line_length = 0;
unbuffered_read = 0;

- /* The following check should be done before reading any lines. Doing it
- here allows us to call bind_array_element instead of bind_array_variable
- and skip the variable lookup on every call. */
+ /* The following check should be done before reading any lines. */
entry = builtin_find_indexed_array (array_name, flags & MAPF_CLEARARRAY);
if (entry == 0)
return EXECUTION_FAILURE;
@@ -201,8 +199,13 @@ mapfile (int fd, long line_count_goal, l
run_callback (callback, array_index, line);
}

- /* XXX - bad things can happen if the callback modifies ENTRY, e.g.,
- unsetting it or changing it to a non-indexed-array type. */
+ /* Bad things can happen if the callback modifies ENTRY, e.g.,
+ unsetting it or changing it to a non-indexed-array type, so we
+ look it up again every time we need to assign something */
+ entry = bind_array_variable (array_name, array_index, line, 0);
+ if (entry == 0 || ASSIGN_DISALLOWED (entry, 0))
+ return EXECUTION_FAILURE;
+
bind_array_element (entry, array_index, line, 0);

/* Have we exceeded # of lines to store? */
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */

-#define PATCHLEVEL 10
+#define PATCHLEVEL 11

#endif /* _PATCHLEVEL_H_ */
48 changes: 48 additions & 0 deletions utils/bash/patches/011-bash_5.3_patch_12.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From ecb2456d6357bfd3b2965aafe2f2021d1ced5b72 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 3 Jun 2026 10:21:45 -0400
Subject: Bash-5.3 patch 12: fix subshells inappropriately running the EXIT
trap if they receive a fatal signal before resetting traps

--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -1643,13 +1643,13 @@ execute_in_subshell (COMMAND *command, i

if (user_subshell)
{
- subshell_environment = SUBSHELL_PAREN; /* XXX */
+ subshell_environment = SUBSHELL_PAREN|SUBSHELL_IGNTRAP; /* XXX */
if (asynchronous)
subshell_environment |= SUBSHELL_ASYNC;
}
else
{
- subshell_environment = 0; /* XXX */
+ subshell_environment = SUBSHELL_IGNTRAP; /* XXX */
if (asynchronous)
subshell_environment |= SUBSHELL_ASYNC;
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */

-#define PATCHLEVEL 11
+#define PATCHLEVEL 12

#endif /* _PATCHLEVEL_H_ */
--- a/sig.c
+++ b/sig.c
@@ -638,7 +638,10 @@ termsig_handler (int sig)
interrupt_execution = retain_fifos = executing_funsub = 0;
comsub_ignore_return = return_catch_flag = wait_intr_flag = 0;

- run_exit_trap (); /* XXX - run exit trap possibly in signal context? */
+ /* Don't run the exit trap if we're supposed to be ignoring traps in a
+ subshell environment. */
+ if ((subshell_environment & SUBSHELL_IGNTRAP) == 0)
+ run_exit_trap (); /* XXX - run exit trap possibly in signal context? */

kill_shell (sig);
}
Loading