zsh-workers
 help / color / mirror / code / Atom feed
* Parser bugs: "local a=()"
@ 2015-07-12  9:13 ryosuke_i_628
  2015-07-12 17:19 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: ryosuke_i_628 @ 2015-07-12  9:13 UTC (permalink / raw)
  To: zsh-workers

--Summary--

Zsh parser recognize "local a=()" as a local function named "a=".
Sometimes that causes segmentation fault.

(in Japanese)
http://qiita.com/mpyw/items/e9e4c3b872b30c7024ee

--Version--

zsh 5.0.8 (x86_64-apple-darwin14.3.0)

--Reproduction--

[funcs.zsh]

    func1() {
        a=( )
        b=false
        echo "a in func1 length: ${#a[@]}"
    }
    func2() {
        local a=( )
        local b=false
        echo "a in func2 length: ${#a[@]}"
    }
    func3() {
        a=()
        b=false
        echo "a in func3 length: ${#a[@]}"
    }
    func4() {
        local a=()
        local b=false
        echo "a in func4 length: ${#a[@]}"
    }

[Your shell-session]

    example@local:~$ zsh
    example@local:~$ zsh --version
    zsh 5.0.8 (x86_64-apple-darwin14.3.0)
    example@local:~$ source funcs.zsh
    example@local:~$ func1
    a in func1 length: 0
    example@local:~$ func2
    func2:1: unknown file attribute:
    example@local:~$ func3
    a in func3 length: 0
    example@local:~$ func4
    a in func4 length: 0
    [1]    35208 segmentation fault  zsh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-12 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-12  9:13 Parser bugs: "local a=()" ryosuke_i_628
2015-07-12 17:19 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).