zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#537283: homing in
       [not found] <20090902070912.GA31041@piper.oerlikon.madduck.net>
@ 2009-09-02 15:00 ` Clint Adams
  2009-09-02 15:20   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Clint Adams @ 2009-09-02 15:00 UTC (permalink / raw)
  To: zsh-workers; +Cc: martin f krafft, 537283

On Wed, Sep 02, 2009 at 09:09:12AM +0200, martin f krafft wrote:
> % precmd_test() { set -x; test -d . && echo . is a directory; set +x; }
> % precmd_functions=(precmd_test)
> +precmd_test:0> test -d .
> +precmd_test:0> echo . is a directory
> . is a directory
> +precmd_test:0> set +x
> % [PRESS CTRL-C]
> +precmd_test:0> test -d .
> precmd_test:test: argument expected
> +precmd_test:0> set +x
> 
> 
> The same happens with [ -d . ], but /usr/bin/test and /usr/bin/[
> work fine. Thus, there must be something fundamentally out of order
> with precmd functions and builtin tests which shows only when precmd
> functions are called without a preceding exec() by the shell.
> Running an external programme before the test from the precmd
> function (e.g. ls >/dev/null) does not work though.
> 
> I can reproduce this with zsh -f.

This is the same with precmd()


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug#537283: homing in
  2009-09-02 15:00 ` Bug#537283: homing in Clint Adams
@ 2009-09-02 15:20   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2009-09-02 15:20 UTC (permalink / raw)
  To: zsh-workers, 537283

Clint Adams wrote:
> On Wed, Sep 02, 2009 at 09:09:12AM +0200, martin f krafft wrote:
> > % precmd_test() { set -x; test -d . && echo . is a directory; set +x; }
> > % precmd_functions=(precmd_test)
> > +precmd_test:0> test -d .
> > +precmd_test:0> echo . is a directory
> > . is a directory
> > +precmd_test:0> set +x
> > % [PRESS CTRL-C]
> > +precmd_test:0> test -d .
> > precmd_test:test: argument expected
> > +precmd_test:0> set +x

Incomplete previous patch (27079).

Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.234
diff -u -r1.234 builtin.c
--- Src/builtin.c	24 Jul 2009 18:35:53 -0000	1.234
+++ Src/builtin.c	2 Sep 2009 15:18:03 -0000
@@ -5818,17 +5818,19 @@
     testlex();
     prog = parse_cond();
     condlex = zshlex;
-    lexrestore();
 
     if (errflag) {
 	errflag = 0;
+	lexrestore();
 	return 1;
     }
 
     if (!prog || tok == LEXERR) {
 	zwarnnam(name, tokstr ? "parse error" : "argument expected");
+	lexrestore();
 	return 1;
     }
+    lexrestore();
 
     if (*curtestarg) {
 	zwarnnam(name, "too many arguments");

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-02 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090902070912.GA31041@piper.oerlikon.madduck.net>
2009-09-02 15:00 ` Bug#537283: homing in Clint Adams
2009-09-02 15:20   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).