On Wed, Sep 05, 2018 at 06:21:36PM +0200, Martijn Dekker wrote:
>
> I don't think discarding the result is enough. The unused word should
> not be evaluated in the first place.
That's exactly what EXP_DISCARD is meant to do. Parse it but
don't evaluate anything with side-effects.
> With this patch applied, the following breakage still occurs:
> $ src/dash -u -c 'unset foo bar; echo ${foo+${bar}}'
> src/dash: 1: bar: parameter not set
> (expected: empty line, no error)
> ...which seems to suggest that ${bar} is evaluated even though foo is unset.
OK so clearly we still have a bug in how EXP_DISCARD is handled.
Let me dig deeper.
Thanks,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt