Op 06-09-18 om 07:07 schreef Herbert Xu:
On Wed, Sep 05, 2018 at 06:21:36PM +0200, Martijn Dekker wrote:
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.
This patch should fix it.
Yes, confirmed.
But now I'm encountering another, similar bug, that was a bit harder to
track down:
$ src/dash -c 'foo=bar; echo ${foo=BUG}; echo $foo'
barBUG
bar
$ src/dash -c 'foo=bar; echo ${foo:=BUG}; echo $foo'
barBUG
bar
Expected output: 'bar' twice in both cases. The ${foo=BUG} and
${foo:=BUG} expansions fail to discard the word 'BUG' if foo is set.
- Martijn