summary refs log tree commit diff
path: root/src/funcs/newgrp
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2018-09-12 14:27:16 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-11-19 18:59:50 +0800
commita29e9a1738a4e7040211842f3f3d90e172fa58ce (patch)
treede70cc7263b01399ad572aae01e0ae07aac76844 /src/funcs/newgrp
parentmain: Print \n upon EOF (CTRL-D) when run interactively (diff)
downloaddash-a29e9a1738a4e7040211842f3f3d90e172fa58ce.tar.gz
dash-a29e9a1738a4e7040211842f3f3d90e172fa58ce.zip
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>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions