diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-06-15 18:12:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-11-23 05:31:30 +0100 |
commit | bb612052900542046ce75e61a4e0b030c946984b (patch) | |
tree | 73d86eb70f874fea5842270aaf88e18404dc60d4 | |
parent | 56a335378ac100d51c30b21eee499a2effa37fba (diff) | |
download | busybox-w32-bb612052900542046ce75e61a4e0b030c946984b.tar.gz busybox-w32-bb612052900542046ce75e61a4e0b030c946984b.tar.bz2 busybox-w32-bb612052900542046ce75e61a4e0b030c946984b.zip |
hush: fix handling of "cmd && &"
function old new delta
done_pipe 213 231 +18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
(cherry picked from commit 83a4967e50422867f340328d404994553e56b839)
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index 249728b9d..41a4653ea 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3694,9 +3694,10 @@ static void debug_print_tree(struct pipe *pi, int lvl) | |||
3694 | 3694 | ||
3695 | pin = 0; | 3695 | pin = 0; |
3696 | while (pi) { | 3696 | while (pi) { |
3697 | fdprintf(2, "%*spipe %d %sres_word=%s followup=%d %s\n", | 3697 | fdprintf(2, "%*spipe %d #cmds:%d %sres_word=%s followup=%d %s\n", |
3698 | lvl*2, "", | 3698 | lvl*2, "", |
3699 | pin, | 3699 | pin, |
3700 | pi->num_cmds, | ||
3700 | (IF_HAS_KEYWORDS(pi->pi_inverted ? "! " :) ""), | 3701 | (IF_HAS_KEYWORDS(pi->pi_inverted ? "! " :) ""), |
3701 | RES[pi->res_word], | 3702 | RES[pi->res_word], |
3702 | pi->followup, PIPE[pi->followup] | 3703 | pi->followup, PIPE[pi->followup] |
@@ -3839,6 +3840,9 @@ static void done_pipe(struct parse_context *ctx, pipe_style type) | |||
3839 | #endif | 3840 | #endif |
3840 | /* Replace all pipes in ctx with one newly created */ | 3841 | /* Replace all pipes in ctx with one newly created */ |
3841 | ctx->list_head = ctx->pipe = pi; | 3842 | ctx->list_head = ctx->pipe = pi; |
3843 | /* for cases like "cmd && &", do not be tricked by last command | ||
3844 | * being null - the entire {...} & is NOT null! */ | ||
3845 | not_null = 1; | ||
3842 | } else { | 3846 | } else { |
3843 | no_conv: | 3847 | no_conv: |
3844 | ctx->pipe->followup = type; | 3848 | ctx->pipe->followup = type; |