From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11921 invoked by alias); 2 Mar 2013 16:37:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31098 Received: (qmail 28044 invoked from network); 2 Mar 2013 16:37:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130302083647.ZM11704@torch.brasslantern.com> Date: Sat, 02 Mar 2013 08:36:47 -0800 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: xtrace and array assignment MIME-version: 1.0 Content-type: text/plain; charset=us-ascii The trace output for assignment to array elements does not expand the index value (the string inside the square brackets): schaefer<512> { cursh> typeset -A traceme cursh> theindex=somestring cursh> set -x cursh> traceme[$theindex]=$theindex cursh> set +x cursh> } : zsh:19:cursh; traceme[$theindex]=somestring : zsh:20:cursh; set +x schaefer<513> I'm a little conflicted about this one because (a) the above behavior matches bash and (b) sometimes seeing it unexpanded is what you want. On the other hand, if I'm tracing a function with "typeset -ft" and the assignment looks like thearray[$2]=thevalue, it'd be helpful to see what $2 is, because the trace does not include the function call itself from the surrounding context. Yes, that specific example can be worked around by adding something such as ": $@" to the top of the function, but there may be other contexts where it's difficult follow where a reference came from, and the intent of typeset -ft is to avoid having to change the function. It's also always irked me a little that the verbose option doesn't print anything for assignments, so maybe combining verbose and xtrace could have some meaning here. However, I haven't really dug in to how xtrace for assignments is implemented, so this might be rather difficult, and of course we don't want to accidentally introduce side-effects.