Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14073 > unrolled thread

Re: [BUG] 'unset' fails silently under specific conditions

Started byChet Ramey <chet.ramey@case.edu>
First post2018-05-01 14:36 -0400
Last post2018-05-01 14:36 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [BUG] 'unset' fails silently under specific conditions Chet Ramey <chet.ramey@case.edu> - 2018-05-01 14:36 -0400

#14073 — Re: [BUG] 'unset' fails silently under specific conditions

FromChet Ramey <chet.ramey@case.edu>
Date2018-05-01 14:36 -0400
SubjectRe: [BUG] 'unset' fails silently under specific conditions
Message-ID<mailman.13221.1525199801.27995.bug-bash@gnu.org>
On 5/1/18 2:29 PM, Martijn Dekker wrote:
> 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"}

OK, so which is it? Does an assignment statement preceding a special
builtin in a shell function create a local variable (as we discussed
just yesterday) or does it create a global variable because `Posix'?
Because if it creates a local variable, that's the one the `unset'
builtin unsets, leaving the global variable created by the first
assignment statement untouched.

I'm not disputing that there were bugs with this construct, just trying
to figure out which behavior you think is correct.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web