Re: [BUG] 'unset' fails silently under specific conditions
From:
Martijn Dekker
Subject:
Re: [BUG] 'unset' fails silently under specific conditions
Date:
Tue, 1 May 2018 20:29:12 +0200
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
Op 01-05-18 om 18:45 schreef Martijn Dekker:
It appears that it must have one function calling another, and that
other function having an assignment preceding a special builtin, for
'unset' to fail silently for the variable so assigned.
Actually it can be simplified further: the following also outputs "BUG:
still set". I fact, with this version, the bug manifests all the way
down to bash 2.05b!
POSIXLY_CORRECT=y
func() {
var=1
var=2 : # or 'var=2 set foo', or another special builtin
unset -v var # bug: fails silently
}
func
echo ${var+"BUG: still set"}
Thanks,
- M.