From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: Re: Very odd behaviour with zsh, maybe corruption bug
Date: Mon, 15 Oct 2001 13:24:02 +0200 [thread overview]
Message-ID: <15306.51026.58822.126859@gargle.gargle.HOWL> (raw)
In-Reply-To: <1011014215607.ZM6899@candle.brasslantern.com>
Bart Schaefer wrote:
> On Oct 12, 5:02am, Bart Schaefer wrote:
> }
> } This *must* be a bug in prefork() called via singsub(); it must be zeroing
> } `right' (and thus also zeroing `opat') before copying the string. But I
> } just can't seem to catch it happening.
>
> Having traced through this more closely, which was rather laborious, I
> have come to the conclusion that the bug is right there in evalcond(),
> and that the following is the fix. At least, I can't see how this patch
> could possibly cause -incorrect- behavior, though it might result in an
> optimization being skipped unnecessarily in some cases.
>
> Sven, please dispute this if you can.
>
> ...
>
> - right = opat = dupstring(ecrawstr(state->prog, state->pc,
> + right = dupstring(opat = ecrawstr(state->prog, state->pc,
> &htok));
This is right. I hadn't realised that paramsubst() (called indirectly
from singsub()) modifies the string it gets even though it gets a
pointer (it's that `*s++ = '\0', I think).
We need a similar fix in execcase(), below is a patch for both of
these, which I will commit to both branches.
Bye
Sven
Index: Src/cond.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/cond.c,v
retrieving revision 1.2
diff -u -r1.2 cond.c
--- Src/cond.c 2000/04/01 20:49:48 1.2
+++ Src/cond.c 2001/10/15 11:23:26
@@ -202,7 +202,7 @@
char *opat;
int save;
- right = opat = dupstring(ecrawstr(state->prog, state->pc,
+ right = dupstring(opat = ecrawstr(state->prog, state->pc,
&htok));
if (htok)
singsub(&right);
Index: Src/loop.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/loop.c,v
retrieving revision 1.5
diff -u -r1.5 loop.c
--- Src/loop.c 2001/06/25 16:07:52 1.5
+++ Src/loop.c 2001/10/15 11:23:26
@@ -543,7 +543,7 @@
if (isset(XTRACE)) {
char *pat2, *opat;
- opat = pat = ecgetstr(state, EC_DUP, NULL);
+ pat = dupstring(opat = ecrawstr(state->prog, state->pc, NULL));
singsub(&pat);
save = (!(state->prog->flags & EF_HEAP) &&
!strcmp(pat, opat) && *spprog != dummy_patprog2);
@@ -565,7 +565,7 @@
char *opat;
int htok = 0;
- opat = pat = dupstring(ecrawstr(state->prog,
+ pat = dupstring(opat = ecrawstr(state->prog,
state->pc - 2, &htok));
if (htok)
singsub(&pat);
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
prev parent reply other threads:[~2001-10-15 11:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-11 10:57 martin.ebourne
2001-10-11 16:30 ` Bart Schaefer
2001-10-12 5:02 ` Bart Schaefer
2001-10-14 21:56 ` PATCH: " Bart Schaefer
2001-10-15 11:24 ` Sven Wischnowsky [this message]
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=15306.51026.58822.126859@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).