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


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

Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode

Started byMartijn Dekker <martijn@inlv.org>
First post2018-04-30 21:40 +0200
Last post2018-04-30 21:40 +0200
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] persistently assigned variable cannot be unexported in POSIX mode Martijn Dekker <martijn@inlv.org> - 2018-04-30 21:40 +0200

#14066 — Re: [BUG] persistently assigned variable cannot be unexported in POSIX mode

FromMartijn Dekker <martijn@inlv.org>
Date2018-04-30 21:40 +0200
SubjectRe: [BUG] persistently assigned variable cannot be unexported in POSIX mode
Message-ID<mailman.13179.1525117224.27995.bug-bash@gnu.org>
Op 30-04-18 om 21:12 schreef Chet Ramey:
>> 2. The bug is: 'declare +x' a.k.a. 'typeset +x' then fails to unexport the
>> variable in the second version above. The variable remains exported past
>> 'typeset +x foo', as proven by grepping the output of 'env'.
> Now you've just created a local variable (typeset in a function creates
> local variables, even in Posix mode) and made sure it doesn't have the
> export attribute. You haven't given it a value, so it remains unset and
> doesn't shadow the exported global you created in step 1.

Of course, that makes complete sense.

However, when adding the -g option, on bash 4.3.30, 4.4.19 and dev 
snapshot 2018-04-20:

$ bash -o posix -c 'fn() { foo=abc : ; typeset -g +x foo; env|grep 
^foo=; }; fn'
foo=abc

Causing 'typeset' to operate on the global scope had no effect. I had 
noticed that it made no difference, so I incorrectly figured the -g flag 
wasn't relevant and left it out of my bug report.

In any case, that still looks like a bug to me... particularly as bash 
4.2.45 works as expected, so it seems to break as of 4.3.

- M.

[toc] | [standalone]


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


csiph-web