1 Stacy Harper reports that this script:
3 test() { . /tmp/bb_test; }
4 echo "export TEST=foo" >/tmp/bb_test
8 correctly prints 'foo' in BusyBox 1.33 but hangs in 1.34.
10 Bisection suggested the problem was caused by commit a1b0d3856 (ash: add
11 process substitution in bash-compatibility mode). Removing the call to
12 unwindredir() in cmdloop() introduced in that commit makes the script
15 Additionally, these examples of process substitution:
17 while true; do cat <(echo hi); done
18 f() { while true; do cat <(echo hi); done }
21 result in running out of file descriptors. This is a regression from
22 v5 of the process substitution patch caused by changes to evalcommand()
23 not being transferred to v6.
25 function old new delta
26 static.pushredir - 99 +99
27 evalcommand 1729 1750 +21
32 ------------------------------------------------------------------------------
33 (add/remove: 1/2 grow/shrink: 2/1 up/down: 137/-147) Total: -10 bytes
35 Signed-off-by: Ron Yorston <rmy at pobox.com>
37 shell/ash.c | 10 +++++++---
38 1 file changed, 7 insertions(+), 3 deletions(-)
40 diff --git a/shell/ash.c b/shell/ash.c
41 index b5947147a..53c140930 100644
44 @@ -10278,6 +10278,9 @@ evalcommand(union node *cmd, int flags)
46 /* First expand the arguments. */
47 TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
48 +#if BASH_PROCESS_SUBST
49 + redir_stop = redirlist;
51 file_stop = g_parsefile;
54 @@ -10356,7 +10359,11 @@ evalcommand(union node *cmd, int flags)
57 expredir(cmd->ncmd.redirect);
58 +#if !BASH_PROCESS_SUBST
59 redir_stop = pushredir(cmd->ncmd.redirect);
61 + pushredir(cmd->ncmd.redirect);
64 if (BASH_XTRACEFD && xflag) {
65 /* NB: bash closes fd == $BASH_XTRACEFD when it is changed.
66 @@ -13476,9 +13483,6 @@ cmdloop(int top)
69 showjobs(SHOW_CHANGED|SHOW_STDERR);
71 -#if BASH_PROCESS_SUBST