Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug Report: Variable becomes unset without reason



2019-08-08 20:38:05 +0430, Aryn Starr:
> I have included the file that reproduces the bug with `zsh -f` and the result of running it in https://gist.github.com/NightMachinary/32689e786a3b7f5865a042d49b884b57 <https://gist.github.com/NightMachinary/32689e786a3b7f5865a042d49b884b57>. 

  Please try and make sure your bug reports are self-contained.
  The zsh ML has been around for decades and along with its
  archives will probably be around for several more decades, but
  we can't tell much about github (that link may become invalid
  at any time).

  We should also not have to fire up a web browser to figure out
  what the bug is about.

Now, that being said, as discussed on U&L it looks like a bug
indeed and a shorter reproducer is:

$ zsh -xc 'v=1; f() { local v; v=2 true; }; f; typeset -p v'
+zsh:1> v=1
+zsh:1> f
+f:0> local v
+f:0> v=2 +f:0> true
+zsh:1> typeset -p v
zsh:typeset:1: no such variable: v

Most likely, that's the "v=2 true" (where "true" is a builtin) that ends up
unsetting the "v" from the global scope.

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author