From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23366 invoked from network); 31 Jul 2008 02:38:38 -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; 31 Jul 2008 02:38:38 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 56693 invoked from network); 31 Jul 2008 02:38:32 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Jul 2008 02:38:32 -0000 Received: (qmail 9552 invoked by alias); 31 Jul 2008 02:38:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25360 Received: (qmail 9534 invoked from network); 31 Jul 2008 02:38:27 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 31 Jul 2008 02:38:27 -0000 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.229]) by bifrost.dotsrc.org (Postfix) with ESMTP id 494B1805A429 for ; Thu, 31 Jul 2008 04:38:24 +0200 (CEST) Received: by rv-out-0506.google.com with SMTP id g37so304329rvb.21 for ; Wed, 30 Jul 2008 19:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=nCWf9y1e+eOr0G0uOeCGXNsXqbku921Jal6GzsWuHAg=; b=uZ2DP8aVEWnbyZ1RbjPRLPTsjbuA5aXfaAdn8g6WdqTHj+t/4ZcBBroWwQaBs0zBI+ wK3X5lvGYvfoLFonCN8Dni7oXbM7BIs/I9fvg+YUAxMi23NRmVIykMmZTElCoFb3AmmT uGw7EA0g3klmeUmNO31Zvq5BDjazc23xMY/A0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=lCPsIpXCUL7swLZmTPpxMP2PMGhf5vrv35aoXM+M7N8bWIucai3E7z0vk/WdQf3qTS Jj9y/GUG4KpS8wW1nkkJnLtL3DUqhki2JA/Jgu0e+jVkeu3lmIuc4sCumcfRK5CC4OR6 8cXyyqrOcEHJbhFiQqgVscvyIU5gaxruXct+k= Received: by 10.114.159.6 with SMTP id h6mr9539811wae.65.1217471903567; Wed, 30 Jul 2008 19:38:23 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Wed, 30 Jul 2008 19:38:23 -0700 (PDT) Message-ID: <6cd6de210807301938m28e05c84vf6296aa5b1bc0d44@mail.gmail.com> Date: Wed, 30 Jul 2008 22:38:23 -0400 From: "Rocky Bernstein" To: zsh-workers@sunsite.dk Subject: Weird exit caused in a trap DEBUG which sources a file. 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/7895/Thu Jul 31 02:57:38 2008 on bifrost X-Virus-Status: Clean Below is a small program whittled down from a larger one. It has behavior I can't figure out. It seems to show that when a function is called via trap DEBUG and you then source a file and it has a statement in it, on return from the TRAP an exit will be taken. Here is the program: #!/usr/bin/zsh function debug_trap_handler { print $functrace[1] do_bug } function do_bug { . ./bug-file } trap 'echo EXIT hit' EXIT trap 'debug_trap_handler' DEBUG a=1 b=2 d=3 In "bug-file" put any command. ":" will do. Or a print statement. Let's say it contains the line: print bug file here When I run the above I get: $ ./zshtrace.sh ./zshtrace.sh:12 bug file here EXIT hit Now if the file contains only comments or blank lines or is empty, here is what I get: $ ./zshtrace.sh ./zshtrace.sh:12 ./zshtrace.sh:13 ./zshtrace.sh:14 ./zshtrace.sh:15 EXIT hit which is what I would expect. Anyone care to venture a guess as to what's going on? It feels like a bug to me, if for no other reason than some message about why the exit was raised is missing. Thanks.