From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22230 invoked by alias); 26 Nov 2010 17:38:48 -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: 28456 Received: (qmail 22303 invoked from network); 26 Nov 2010 17:38:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <101126093810.ZM25915@torch.brasslantern.com> Date: Fri, 26 Nov 2010 09:38:10 -0800 In-reply-to: <20101126115148.GT1254@prunille.vinc17.org> Comments: In reply to Vincent Lefevre "PROMPT_SP bug with local in precmd" (Nov 26, 12:51pm) References: <20101126115148.GT1254@prunille.vinc17.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: PROMPT_SP bug with local in precmd MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 26, 12:51pm, Vincent Lefevre wrote: } } ypig% precmd() { local v=bar } } ypig% echo -n foo; false } foozsh: exit 1 It's not "local" that triggers this, it's any command: torch% precmd() { : } torch% echo -n foo; false foozsh: exit 1 torch% precmd() { echo -n Hi } Hi% torch% echo -n foo; false foozsh: exit 1 Hi% torch% precmd() { /bin/echo -n Hi } Hi% torch% echo -n foo; false foozsh: exit 1 Hi% zsh: exit 1 torch% This makes me suspect it's not so much a bug as a race condition -- when there is a command in precmd, the order in which the exit values from children (even fake children) are collected and reported is changed. Note how "zsh: exit 1" is printed twice when the precmd is a forked process instead of all builtins. My conclusion from this is that "foozsh: exit 1" is what you really ought to be seeing all the time, and "zsh: exit 1" on its own line is a side-effect of a stdio buffer never having been flushed.