From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16536 invoked from network); 29 Dec 2007 18:33:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 29 Dec 2007 18:33:41 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 47039 invoked from network); 29 Dec 2007 18:33:35 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 29 Dec 2007 18:33:34 -0000 Received: (qmail 25026 invoked by alias); 29 Dec 2007 18:33:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24324 Received: (qmail 25006 invoked from network); 29 Dec 2007 18:33:30 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 29 Dec 2007 18:33:30 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id 3BB638058F9B for ; Sat, 29 Dec 2007 19:33:28 +0100 (CET) Received: from vms173001pub.verizon.net (vms173001pub.verizon.net [206.46.173.1]) by bifrost.dotsrc.org (Postfix) with ESMTP for ; Sat, 29 Dec 2007 19:33:27 +0100 (CET) Received: from torch.brasslantern.com ([71.121.18.67]) by vms173001.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JTT008OPPST53A3@vms173001.mailsrvcs.net> for zsh-workers@sunsite.dk; Sat, 29 Dec 2007 12:24:30 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id lBTIX9lH007559 for ; Sat, 29 Dec 2007 10:33:10 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id lBTIX9pY007558 for zsh-workers@sunsite.dk; Sat, 29 Dec 2007 10:33:09 -0800 Date: Sat, 29 Dec 2007 10:33:07 -0800 From: Bart Schaefer Subject: Re: zero elapsed time in history with certain preexec functions In-reply-to: <477154ED.70001@csail.mit.edu> To: zsh-workers@sunsite.dk Message-id: <071229103309.ZM7557@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <477154ED.70001@csail.mit.edu> Comments: In reply to Michael Kaminsky "zero elapsed time in history with certain preexec functions" (Dec 25, 2:07pm) X-Virus-Scanned: ClamAV using ClamSMTP On Dec 25, 2:07pm, Michael Kaminsky wrote: } } It appears that subscripting a variable (or indexing into a zsh array) } inside of the preexec function causes zsh not to record the elapsed } time/duration of the command. A time is recorded, but it's the wrong time. The following seems to fix it, but someone more familiar with this part of the history mechanism should check my work: Index: Src/hist.c =================================================================== diff -c -r1.31 hist.c --- Src/hist.c 26 Nov 2007 17:38:13 -0000 1.31 +++ Src/hist.c 29 Dec 2007 18:24:06 -0000 @@ -826,7 +826,7 @@ } chwordpos = 0; - if (hist_ring && !hist_ring->ftim) + if (hist_ring && !hist_ring->ftim && !strin) hist_ring->ftim = time(NULL); if ((dohist == 2 || (interact && isset(SHINSTDIN))) && !strin) { histactive = HA_ACTIVE; (Revision numbers are from my local CVS repository and bear no relation to the Sourceforce repository.) --