openwrt/package/utils/busybox/patches/002-backport-ash-process-su...

78 lines
2.5 KiB
Diff
Raw Normal View History

busybox: update to version 1.34.0 Update busybox to version 1.34.0 * Remove upstreamed patches (205, 530, 540) * Remove one old patch that does not apply any more. (203) That was originally introduced in 2008 with 563d23459, but does not apply after busybox restructuring with https://git.busybox.net/busybox/commit/networking/udhcp/dhcpc.c?h=1_34_stable&id=e6007c4911c3ea26925f9473b9f156a692585f30 and https://git.busybox.net/busybox/commit/networking/udhcp/dhcpc.c?h=1_34_stable&id=1c7253726fcbab09917f143f0b703efbd2df55c3 * Refresh config and patches. * Backport upstream fixes for - MIPS compilation breakage and - process substitution regression Config refresh: Refresh commands, run after busybox is first built once: cd utils/busybox/ cd config/ ../convert_menuconfig.pl ../../../../build_dir/target-aarch64_cortex-a53_musl/busybox-default/busybox-1.34.0 cd .. ./convert_defaults.pl < ../../../build_dir/target-aarch64_cortex-a53_musl/busybox-default/busybox-1.34.0/.config > Config-defaults.in Manual edits needed afterward: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt configTARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) BUSYBOX_DEFAULT_UDHCPC_DEFAULT_INTERFACE (just "") * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in : change at "Options common to all shells" the symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014f) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-08-31 17:12:44 +02:00
Stacy Harper reports that this script:
test() { . /tmp/bb_test; }
echo "export TEST=foo" >/tmp/bb_test
test 2>/dev/null
echo "$TEST"
correctly prints 'foo' in BusyBox 1.33 but hangs in 1.34.
Bisection suggested the problem was caused by commit a1b0d3856 (ash: add
process substitution in bash-compatibility mode). Removing the call to
unwindredir() in cmdloop() introduced in that commit makes the script
work again.
Additionally, these examples of process substitution:
while true; do cat <(echo hi); done
f() { while true; do cat <(echo hi); done }
f
result in running out of file descriptors. This is a regression from
v5 of the process substitution patch caused by changes to evalcommand()
not being transferred to v6.
function old new delta
static.pushredir - 99 +99
evalcommand 1729 1750 +21
exitreset 69 86 +17
cmdloop 372 365 -7
unwindredir 28 - -28
pushredir 112 - -112
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/1 up/down: 137/-147) Total: -10 bytes
Signed-off-by: Ron Yorston <rmy at pobox.com>
---
shell/ash.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/shell/ash.c b/shell/ash.c
index b5947147a..53c140930 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10278,6 +10278,9 @@ evalcommand(union node *cmd, int flags)
/* First expand the arguments. */
TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
+#if BASH_PROCESS_SUBST
+ redir_stop = redirlist;
+#endif
file_stop = g_parsefile;
back_exitstatus = 0;
@@ -10356,7 +10359,11 @@ evalcommand(union node *cmd, int flags)
lastarg = nargv[-1];
expredir(cmd->ncmd.redirect);
+#if !BASH_PROCESS_SUBST
redir_stop = pushredir(cmd->ncmd.redirect);
+#else
+ pushredir(cmd->ncmd.redirect);
+#endif
preverrout_fd = 2;
if (BASH_XTRACEFD && xflag) {
/* NB: bash closes fd == $BASH_XTRACEFD when it is changed.
@@ -13476,9 +13483,6 @@ cmdloop(int top)
#if JOBS
if (doing_jobctl)
showjobs(SHOW_CHANGED|SHOW_STDERR);
-#endif
-#if BASH_PROCESS_SUBST
- unwindredir(NULL);
#endif
inter = 0;
if (iflag && top) {
--
2.31.1