zsh-workers
 help / color / mirror / code / Atom feed
From: ryosuke_i_628@yahoo.co.jp
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Parser bugs: "local a=()"
Date: Sun, 12 Jul 2015 18:13:18 +0900 (JST)	[thread overview]
Message-ID: <766191.98675.qm@web100002.mail.kks.yahoo.co.jp> (raw)

--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


             reply	other threads:[~2015-07-12  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-12  9:13 ryosuke_i_628 [this message]
2015-07-12 17:19 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=766191.98675.qm@web100002.mail.kks.yahoo.co.jp \
    --to=ryosuke_i_628@yahoo.co.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).