zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: segfaults in 4.0.2
Date: Tue, 25 Sep 2001 14:07:24 +0200	[thread overview]
Message-ID: <15280.29564.199223.966604@gargle.gargle.HOWL> (raw)
In-Reply-To: <1010908184745.ZM19990@candle.brasslantern.com>


[Hi, I'm back.]

Bart Schaefer wrote:

> On Sep 8, 11:34am, Clint Adams wrote:
> }
> } Yes.  It doesn't happen with -f.
> } I can reproduce it this way:
> } 
> } prompt ${${(z):-adam1 adam2 bigfade clint elite2}[RANDOM%5]}
> } coproc || echo test
> 
> Hmm, the `pc' field in the wordcode state struct is messed up:
> 
> Breakpoint 1, ecgetstr (s=0xbffff6bc, dup=0, tok=0x0)
>     at ../../zsh-4.0/Src/parse.c:2102
> 2102        wordcode c = *s->pc++;
> (gdb) n
> 2105        if (c == 6 || c == 7)
> (gdb) p s->strs
> $6 = 0x4011b190 "echo"
> (gdb) p c
> $7 = 1074856044
> 
> This causes ecgetstr() to return a garbage pointer.

I couldn't make it crash, but I can see the problem: it's that empty
sublist, which the code in text.c wasn't able to handle (it made it
effectively look one code too far ahead).  The code in exec.c has an
extra test for that, so I've just (more or less) copied it from there.


Bye
  Sven

Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.7
diff -u -r1.7 text.c
--- Src/text.c	2001/08/16 08:48:27	1.7
+++ Src/text.c	2001/09/25 12:01:50
@@ -274,10 +274,12 @@
 	    break;
 	case WC_SUBLIST:
 	    if (!s) {
+                if (wc_code(*state->pc) != WC_PIPE)
+                    stack = 1;
 		if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_NOT)
-		    taddstr("! ");
+		    taddstr(stack ? "!" : "! ");
 		if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_COPROC)
-		    taddstr("coproc ");
+		    taddstr(stack ? "coproc" : "coproc ");
 		s = tpush(code, (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END));
 	    } else {
 		if (!(stack = (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END))) {

-- 
Sven Wischnowsky                    wischnow@informatik.hu-berlin.de


  reply	other threads:[~2001-09-25 12:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-07 23:43 periodic " Allan Poindexter
2001-09-08  0:03 ` Bart Schaefer
2001-09-08  0:22   ` Allan Poindexter
2001-09-08  5:59   ` segfaults " Clint Adams
2001-09-08  7:00     ` Bart Schaefer
2001-09-08 15:34       ` Clint Adams
2001-09-08 18:47         ` Bart Schaefer
2001-09-25 12:07           ` Sven Wischnowsky [this message]
2001-09-25 12:48             ` Sven Wischnowsky
2001-09-10 10:47   ` periodic " Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15280.29564.199223.966604@gargle.gargle.HOWL \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).