From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5517 invoked from network); 1 Sep 2008 01:49:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,WEIRD_PORT autolearn=no version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Sep 2008 01:49:01 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 72993 invoked from network); 1 Sep 2008 01:48:38 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Sep 2008 01:48:38 -0000 Received: (qmail 21588 invoked by alias); 1 Sep 2008 01:48:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25573 Received: (qmail 21570 invoked from network); 1 Sep 2008 01:48:30 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 1 Sep 2008 01:48:30 -0000 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.177]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6ECAB80561C3 for ; Mon, 1 Sep 2008 03:46:54 +0200 (CEST) Received: by wa-out-1112.google.com with SMTP id v27so1244813wah.21 for ; Sun, 31 Aug 2008 18:46:53 -0700 (PDT) Received: by 10.114.148.1 with SMTP id v1mr4781984wad.199.1220226374648; Sun, 31 Aug 2008 16:46:14 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Sun, 31 Aug 2008 16:46:14 -0700 (PDT) Message-ID: <6cd6de210808311646r6c065d71n3e04a9851d3158a8@mail.gmail.com> Date: Sun, 31 Aug 2008 19:46:14 -0400 From: "Rocky Bernstein" To: "Zsh hackers list" Subject: eval line number weirdness MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: ClamAV 0.92.1/8122/Sun Aug 31 03:04:56 2008 on bifrost X-Virus-Status: Clean I think that the line numbers reported in eval statements are bit hard to explain. Consider this program debug_hook() { print $funcfiletrace[1] $functrace[1]; } set -o DEBUG_BEFORE_CMD trap "debug_hook" DEBUG fn() { a=1 eval "b=2" c=3 } fn w=5 eval "x=6 y=7" z=8 which reports: linebug3.sh:4 linebug3.sh:4 linebug3.sh:9 linebug3.sh:9 linebug3.sh:5 fn:1 linebug3.sh:6 fn:2 linebug3.sh:5 fn:1 # Should be linebug3.sh:6 eval:1 ? linebug3.sh:7 fn:3 linebug3.sh:10 linebug3.sh:10 linebug3.sh:11 linebug3.sh:11 linebug3.sh:1 linebug3.sh:1 # Should be linebug3.sh:11 eval:1 ? linebug3.sh:2 linebug3.sh:2 # Should be linebug3.sh:12 eval:2 ? linebug3.sh:13 linebug3.sh:13 The problem is in describing exactly what is reported when eval gets run and having that mean something meaningful. With funcfiletrace, an absolute line number in a file name is I think supposed to be reported. So the 1 and 2 listed above (which is relative to the line number eval sees) doesn't seem right. And while for functrace it is okay to report line 1 and 2, the function name isn't right -- it should be eval than either fn or linebug3.sh. If functrace is supposed to report the line offset of the thing it is in (which seems dubious to me), then the above information isn't right. Instead of fn:1 we would get instead fn:2 since the eval is on the second line of fn; And presumably instead of linebug:1 one would see linebug:11.