From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: parser (was: Re: PATCH: Improved _mailboxes)
Date: Thu, 24 Feb 2000 11:03:14 +0100 (MET) [thread overview]
Message-ID: <200002241003.LAA18138@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Wed, 23 Feb 2000 18:58:28 +0000
Peter Stephenson wrote:
> This will probably be my last email for a while...
>
> Sven Wischnowsky wrote:
> > Here is the first of the two. As I said, this mainly makes the parser
> > create wordcode directly, no more extra compilation phase.
>
> I'm getting a core dump in zfinit from my .zshrc (after both patches, in
> fact). It's in text.c. Actually, there seem to be two bugs there. One
> happens when a function is empty and you run `which' or equivalent:
> getpermtext() calls gettext2() without realising that the prog.len is zero,
> so it's only going to find garbage. This must be because the code for
> end-of-text is not being added, or if it was removed it's not being tested
> enough.
Oops. There were only three places where I forgot to use par_save_list()
instead of par_list(). That's fixed now.
> I can't offhand see what's causing the second, but this seems to tickle it
> on my system (although I only tried this after masking out the previous one
> by putting an if (prog.len) before the call to gettext2()):
>
> chpwd() {
> if [[ ${+ZFTP_USER} = 1 && -n $ZFTP_USER ]]; then
> zftp_chpwd
> else
> [[ -t 1 && -t 2 ]] && header -P "%m: %~";
> fi
> }
> which chpwd
>
> causes a crash with a backtrace as follows, although it's probably more
> useful to know that it seems to go wrong at the start of the second `[['.
The problem was that I forgot to tell text.c about simplified sublists.
Bye
Sven
diff -ru ../z.old/Src/parse.c Src/parse.c
--- ../z.old/Src/parse.c Thu Feb 24 10:46:25 2000
+++ Src/parse.c Thu Feb 24 10:54:02 2000
@@ -1154,13 +1154,13 @@
yylex();
if (tok == INBRACE && usebrace) {
yylex();
- par_list(complex);
+ par_save_list(complex);
if (tok != OUTBRACE) {
cmdpop();
YYERRORV(oecused);
}
} else {
- par_list(complex);
+ par_save_list(complex);
if (tok != FI) {
cmdpop();
YYERRORV(oecused);
@@ -1507,7 +1507,7 @@
int c = 0;
yylex();
- par_list(&c);
+ par_save_list(&c);
if (tok != OUTBRACE) {
cmdpop();
lineno += oldlineno;
diff -ru ../z.old/Src/text.c Src/text.c
--- ../z.old/Src/text.c Thu Feb 24 10:46:26 2000
+++ Src/text.c Thu Feb 24 10:58:46 2000
@@ -269,7 +269,7 @@
taddstr("! ");
if (WC_SUBLIST_FLAGS(code) & WC_SUBLIST_COPROC)
taddstr("coproc ");
- tpush(code, (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END));
+ s = tpush(code, (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END));
} else {
if (!(stack = (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END))) {
taddstr((WC_SUBLIST_TYPE(code) == WC_SUBLIST_OR) ?
@@ -282,6 +282,8 @@
taddstr("coproc ");
}
}
+ if (!stack && (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_SIMPLE))
+ state->pc++;
break;
case WC_PIPE:
if (!s) {
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-02-24 10:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-02-24 10:03 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-02-25 8:41 Sven Wischnowsky
2000-02-25 9:55 ` Andrej Borsenkow
2000-02-24 9:07 Sven Wischnowsky
2000-02-24 18:08 ` Bart Schaefer
2000-02-24 8:54 Sven Wischnowsky
2000-02-23 13:21 Sven Wischnowsky
2000-02-23 16:45 ` Bart Schaefer
2000-02-23 18:58 ` Peter Stephenson
2000-02-24 7:47 ` Andrej Borsenkow
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=200002241003.LAA18138@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.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).