zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: side effect of promptsubst.
@ 2000-05-04  8:41 Sven Wischnowsky
  2000-05-04  8:53 ` Tanaka Akira
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-05-04  8:41 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> Z(4):akr@serein% zsh -f
> serein% setopt promptsubst
> serein% print -lr - ' 
> quote> aaaaaaaaaaaaaaaaaaaaaaaaaaabcdddddddd'
>  
> aaaaaaaaaaaaaaaaaaaaaaaaaaab
> serein%
> 
> The argument is truncated.  This problem doesn't arised without
> promptsubst.

Missing save/restore for one of the variables used during lexing.

Bye
 Sven

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.3
diff -u -r1.3 lex.c
--- Src/lex.c	2000/04/06 17:21:52	1.3
+++ Src/lex.c	2000/05/04 08:41:03
@@ -178,6 +178,7 @@
     char *yytext;
     char *bptr;
     int bsiz;
+    int len;
     short *chwords;
     int chwordlen;
     int chwordpos;
@@ -236,6 +237,7 @@
     ls->yytext = yytext;
     ls->bptr = bptr;
     ls->bsiz = bsiz;
+    ls->len = len;
     ls->chwords = chwords;
     ls->chwordlen = chwordlen;
     ls->chwordpos = chwordpos;
@@ -296,6 +298,7 @@
     yytext = lstack->yytext;
     bptr = lstack->bptr;
     bsiz = lstack->bsiz;
+    len = lstack->len;
     chwords = lstack->chwords;
     chwordlen = lstack->chwordlen;
     chwordpos = lstack->chwordpos;

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


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

* Re: PATCH: Re: side effect of promptsubst.
  2000-05-04  8:41 PATCH: Re: side effect of promptsubst Sven Wischnowsky
@ 2000-05-04  8:53 ` Tanaka Akira
  0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 2000-05-04  8:53 UTC (permalink / raw)
  To: zsh-workers

In article <200005040841.KAA20875@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> Missing save/restore for one of the variables used during lexing.

Thanks.  The problem is fixed.  But... 

| % make check
| cd Test ; gmake check
| gmake[1]: Entering directory `/home/akr/zsh/zsh/Test'
| if test -n "gcc"; then \
|   cd .. && \
|   gmake MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
| fi
| for f in ./*.ztst; do \
|   ../Src/zsh -f ./ztst.zsh $f; \
| done
| ./01grammar.ztst: all tests successful.
| ./02alias.ztst: all tests successful.
| ./03quoting.ztst: all tests successful.
| ./04redirect.ztst: all tests successful.
| ./05command.ztst: all tests successful.
| ./06arith.ztst: all tests successful.
| ./07cond.ztst: all tests successful.
| This test takes at least three seconds...
| This test, too, takes at least three seconds...
| ./08traps.ztst: all tests successful.
| ./09funcdef.ztst: all tests successful.
| Oops. Bug in parse_subst_string: c != STRING
| ./10prompt.ztst: all tests successful.
| ./11glob.ztst: all tests successful.
| ./12procsubst.ztst: all tests successful.
| *** /tmp/zsh.ztst.out.11863     Thu May  4 17:52:11 2000
| --- /tmp/zsh.ztst.tout.11863    Thu May  4 17:52:11 2000
| ***************
| *** 1 ****
| ! and now even the pubs are shut.
| --- 1 ----
| ! 'and now' "even the pubs" \a\r\e shut.
| Test ./13parameter.ztst failed: output differs from expected as shown above for:
|   foo="'and now' \"even the pubs\" \\a\\r\\e shut."
|   print -r ${(Q)foo}
| Error output:
| Oops. Bug in parse_subst_string: len < l
| Was testing: ${(Q)...}
| ./13parameter.ztst: test failed.
| ./50cd.ztst: all tests successful.
| ./51xtrace.ztst: all tests successful.
| ./52zregexparse.ztst: all tests successful.
| *** /tmp/zsh.ztst.out.12302     Thu May  4 17:52:14 2000
| --- /tmp/zsh.ztst.tout.12302    Thu May  4 17:52:21 2000
| ***************
| *** 1,12 ****
|   line: {: }{}
| ! DESCRIPTION:{file}
| ! DI:{dir1}
| ! DI:{dir2}
| ! FI:{file1}
| ! FI:{file2}
| ! line: {: dir1/}{}
| ! line: {: dir2/}{}
| ! line: {: file1}{}
| ! line: {: file2}{}
| ! line: {: dir1/}{}
| ! line: {: dir2/}{}
| --- 1,7 ----
|   line: {: }{}
| ! line: {: }{}
| ! line: {: }{}
| ! line: {: }{}
| ! line: {: }{}
| ! line: {: }{}
| ! line: {: }{}
| Test ./53completion.ztst failed: output differs from expected as shown above for:
|   comptest $': \t\t\t\t\t\t\t'
| Error output:
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Oops. Bug in parse_subst_string: len < l
| Was testing: directories and files
| ./53completion.ztst: test failed.
| gmake[1]: *** [check] Error 1
| gmake[1]: Leaving directory `/home/akr/zsh/zsh/Test'
| gmake: *** [check] Error 2
-- 
Tanaka Akira


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

* PATCH: Re: side effect of promptsubst.
@ 2000-05-04 10:39 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 2000-05-04 10:39 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> ...
> |   foo="'and now' \"even the pubs\" \\a\\r\\e shut."
> |   print -r ${(Q)foo}
> | Error output:
> | Oops. Bug in parse_subst_string: len < l

Hmhm. The other uses of `len' look good.

Bye
 Sven

Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.4
diff -u -r1.4 lex.c
--- Src/lex.c	2000/05/04 08:43:31	1.4
+++ Src/lex.c	2000/05/04 09:56:55
@@ -1447,7 +1447,7 @@
 int
 parse_subst_string(char *s)
 {
-    int c, l = strlen(s), err;
+    int c, l = strlen(s), err, olen;
 
     if (! *s)
 	return 0;
@@ -1464,6 +1464,7 @@
     strinend();
     inpop();
     DPUTS(cmdsp, "BUG: parse_subst_string: cmdstack not empty.");
+    olen = len;
     lexrestore();
     errflag = err;
     if (c == LEXERR) {
@@ -1471,9 +1472,9 @@
 	return 1;
     }
 #ifdef DEBUG
-    if (c != STRING || len != l || errflag) {
+    if (c != STRING || olen != l || errflag) {
 	fprintf(stderr, "Oops. Bug in parse_subst_string: %s\n",
-		len < l ? "len < l" : errflag ? "errflag" : "c != STRING");
+		olen < l ? "len < l" : errflag ? "errflag" : "c != STRING");
 	fflush(stderr);
 	untokenize(s);
 	return 1;

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


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

end of thread, other threads:[~2000-05-04 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-04  8:41 PATCH: Re: side effect of promptsubst Sven Wischnowsky
2000-05-04  8:53 ` Tanaka Akira
2000-05-04 10:39 Sven Wischnowsky

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).