diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-22 19:38:40 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-02-24 19:20:51 +0100 |
commit | 1555895b4af44ce47fe2365aec82e8e67c685f08 (patch) | |
tree | bd821be779bc1d489ac966b0d83e4a5e026979dd /libbb/read.c | |
parent | 823318822ccb0e0910abbd4e1f983637dfd9d3c0 (diff) | |
download | busybox-1555895b4af44ce47fe2365aec82e8e67c685f08.tar.gz |
ash: expand: Fix multiple issues with EXP_DISCARD in evalvar
Upstream commit:
Date: Wed, 12 Sep 2018 14:27:16 +0800
expand: Fix multiple issues with EXP_DISCARD in evalvar
The commit 3cd538634f71538370f5af239f342aec48b7470b broke parameter
expansion in multiple ways because the EXP_DISCARD flag wasn't set
or tested for various cases:
$ src/dash -c 'var=; echo ${var:+nonempty}'
nonempty
$ src/dash -u -c 'unset foo bar; echo ${foo+${bar}}'
dash: 1: bar: parameter not set
$ src/dash -c 'foo=bar; echo ${foo=BUG}; echo $foo'
barBUG
bar
$
This patch fixes them by introducing a new discard variable that
tracks whether the extra word should be discarded or not when it
is parsed.
Reported-by: Martijn Dekker <martijn@inlv.org>
Fixes: 3cd538634f71 ("expand: Do not reprocess data when...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Reported-by: Martijn Dekker <martijn@inlv.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/read.c')
0 files changed, 0 insertions, 0 deletions