Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in alias expansion
- X-seq: zsh-workers 37121
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Bug in alias expansion
- Date: Sun, 15 Nov 2015 13:52:18 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=u4mVco92OxKiUhmwg880EDffKqkUssH73dR+WtGqHPM=; b=Y0/l9D0mUcMQsA/OJv+J8Zc5iHRSXjuQUDB8alrfkoDgLINSAYPvvZgCzTiisewNF7 H+G8RN4dsrDaKPRHd7Jshjc5bvtn9Hg+Cq6eKXg/l9+2HYXq3epBbw+Gu2h0vcFue2Y9 pk3A5UqVF7eKCR93CTpKf9IUWChCKGS5qW+wYv1ByQnr1A4t0LusjCneOUQgePv9VlM3 HYDNW0b1lVr+eClnfBVpxfVPEhVAT6NnhtS1pLTl7th/Ej0zE+xrcYwB0a47uBfijvTk IAwzL2kwSNPHf+2jcddMC5Zycz3m0w2ie+pEPcxmYsEUdsbly0LqjQ073lKAde1BXko1 z6yw==
- In-reply-to: <20151115200356.0f3a80a2@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAFvQaj4AKN36Ntdxt0rNCqPxWFHtjLMt3zPK65y2Xf9G5iUfWA@mail.gmail.com> <20151115200356.0f3a80a2@ntlworld.com>
On Nov 15, 8:03pm, Peter Stephenson wrote:
}
} On Fri, 13 Nov 2015 13:03:52 -0500
} Kynn Jones <kynnjo@xxxxxxxxx> wrote:
} > % typeset -A frobozz
} > % alias -g foo='echo xyz'
} > % frobozz[$(foo)]=9
} > zsh: not an identifier: frobozz[$(fooech9
}
} This is somewhere in the vicinity of parse_subscript(). That's called
} both from isident() and getindex(); I got as far as the case called from
} isident(), but it may be the second one gets called, too.
[...]
} I don't know why this works in other contexts.
When called from "typeset frobozz[$(foo)]=9" the ($foo) has been expanded
before parse_subscript() is called the first time [via isident()]:
Breakpoint 1, parse_subscript (s=0xb7d919e8 "xyz]", sub=1, endchar=93)
at ../../zsh-5.0/Src/lex.c:1620
When called as a plain assignment without the "typeset" keyword, $(foo)
has not yet been expanded:
Breakpoint 1, parse_subscript (s=0xb7d917f8 "$(foo)]", sub=1, endchar=93)
at ../../zsh-5.0/Src/lex.c:1620
This call is originating from addvars():
#0 parse_subscript (s=0xb7d91820 "$(foo)]", sub=1, endchar=93)
at ../../zsh-5.0/Src/lex.c:1620
#1 0x080b2334 in isident (s=0xb7d91818 "frobozz[$(foo)]")
at ../../zsh-5.0/Src/params.c:1078
#2 0x080b6660 in assignsparam (s=0xb7d91818 "frobozz[$(foo)]",
val=0x88bbdf0 "9", flags=0) at ../../zsh-5.0/Src/params.c:2741
#3 0x08078342 in addvars (state=0xbfe30f70, pc=0xb7d917a8, addflags=0)
at ../../zsh-5.0/Src/exec.c:2348
#4 0x08074dff in execsimple (state=0xbfe30f70)
at ../../zsh-5.0/Src/exec.c:1118
So the real question may be, how did we get as far as execsimple()
without having expanded all the aliases first?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author