zsh-workers
 help / color / mirror / code / Atom feed
* Infinite loop (?) in "typeset"
@ 2000-03-19 20:59 Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-03-19 20:59 UTC (permalink / raw)
  To: zsh-workers

It seems to be trying to print out the body of the _normal function from
the $functions assoc, but I'm not quite sure.  It repeatedly executes

228         while (1) {
229             if (stack) {
230                 if (!(s = tstack))
232                 if (s->pop) {
237                 code = s->code;
238                 stack = 0;
239             } else {
243             switch (wc_code(code)) {
697                 stack = 1;
698                 break;

(gdb) where
#0  0x80a0bc4 in gettext2 (state=0xbfffefac) at ../../zsh-3.1.6/Src/text.c:229
#1  0x80a0a8a in getpermtext (prog=0x80e9ff8, c=0x80d52c8)
    at ../../zsh-3.1.6/Src/text.c:125
#2  0x40147a7a in scanfunctions (ht=0x80dda38, 
    func=0x808bb34 <printparamnode>, flags=8, dis=0)
    at ../../../zsh-3.1.6/Src/Modules/parameter.c:516
#3  0x40147aff in scanpmfunctions (ht=0x80dda38, 
    func=0x808bb34 <printparamnode>, flags=8)
    at ../../../zsh-3.1.6/Src/Modules/parameter.c:532
#4  0x806a770 in scanhashtable (ht=0x80dda38, sorted=0, flags1=0, 
    flags2=1048576, scanfunc=0x808bb34 <printparamnode>, scanflags=8)
    at ../../zsh-3.1.6/Src/hashtable.c:367
#5  0x808bf86 in printparamnode (hn=0x80c81a0, printflags=2)
    at ../../zsh-3.1.6/Src/params.c:3116
#6  0x806a8b0 in scanhashtable (ht=0x80c7438, sorted=1, flags1=0, flags2=0, 
    scanfunc=0x808bb34 <printparamnode>, scanflags=2)
    at ../../zsh-3.1.6/Src/hashtable.c:388
#7  0x80547b3 in bin_typeset (name=0x400e4980 "typeset", argv=0xbffff48c, 
    ops=0xbffff4ec "", func=0) at ../../zsh-3.1.6/Src/builtin.c:1853
#8  0x805165d in execbuiltin (args=0x400e4968, bn=0x80b1328)
    at ../../zsh-3.1.6/Src/builtin.c:368
#9  0x806140a in execcmd (state=0xbffff7a0, input=0, output=0, how=18, last1=2)
    at ../../zsh-3.1.6/Src/exec.c:2253
#10 0x805e20b in execpline2 (state=0xbffff7a0, pcode=8771, how=18, input=0, 
    output=0, last1=0) at ../../zsh-3.1.6/Src/exec.c:1179
#11 0x805d79b in execpline (state=0xbffff7a0, slcode=3074, how=18, last1=0)
    at ../../zsh-3.1.6/Src/exec.c:972
#12 0x805d199 in execlist (state=0xbffff7a0, dont_change_job=0, exiting=0)
    at ../../zsh-3.1.6/Src/exec.c:819
#13 0x805ce9b in execode (p=0x400e4928, dont_change_job=0, exiting=0)
    at ../../zsh-3.1.6/Src/exec.c:725
#14 0x807037a in loop (toplevel=1, justonce=0)
    at ../../zsh-3.1.6/Src/init.c:150
#15 0x8050c50 in main (argc=2, argv=0xbffff81c)
    at ../../zsh-3.1.6/Src/main.c:86

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Infinite loop (?) in "typeset"
  2000-03-20 10:56 Sven Wischnowsky
@ 2000-03-20 18:17 ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-03-20 18:17 UTC (permalink / raw)
  To: zsh-workers

On Mar 20, 11:56am, Sven Wischnowsky wrote:
} Subject: Re: Infinite loop (?) in "typeset"
}
} Bart Schaefer wrote:
} 
} > It seems to be trying to print out the body of the _normal function
} 
} I couldn't reproduce it (_normal works for me).

I can't reproduce it either.  It happened in a shell that had been running
for some while, and where I had repeatedly used vared on a few elements of
the functions array ...

} Could you try the patch below?

It doesn't appear to break anything, but I can't say whether it helps
just now ... I'll keep an eye out.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Infinite loop (?) in "typeset"
@ 2000-03-20 10:56 Sven Wischnowsky
  2000-03-20 18:17 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-03-20 10:56 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> It seems to be trying to print out the body of the _normal function from
> the $functions assoc, but I'm not quite sure.  It repeatedly executes
> 
> 228         while (1) {
> 229             if (stack) {
> 230                 if (!(s = tstack))
> 232                 if (s->pop) {
> 237                 code = s->code;
> 238                 stack = 0;
> 239             } else {
> 243             switch (wc_code(code)) {
> 697                 stack = 1;
> 698                 break;

I couldn't reproduce it (_normal works for me). The only thing that
has changed there lately was that (..) and {..} now have a WC_END
after their bodies.

Could you try the patch below?

Bye
 Sven

diff -ru ../z.old/Src/text.c Src/text.c
--- ../z.old/Src/text.c	Mon Mar 20 11:28:50 2000
+++ Src/text.c	Mon Mar 20 11:50:23 2000
@@ -194,6 +194,9 @@
 	struct {
 	    int par;
 	} _cond;
+	struct {
+	    Wordcode end;
+	} _subsh;
     } u;
 };
 
@@ -329,8 +332,10 @@
 	    if (!s) {
 		taddstr("( ");
 		tindent++;
-		tpush(code, 1);
+		n = tpush(code, 1);
+		n->u._subsh.end = state->pc + WC_SUBSH_SKIP(code);
 	    } else {
+		state->pc = s->u._subsh.end;
 		tindent--;
 		taddstr(" )");
 		stack = 1;
@@ -340,8 +345,10 @@
 	    if (!s) {
 		taddstr("{ ");
 		tindent++;
-		tpush(code, 1);
+		n = tpush(code, 1);
+		n->u._subsh.end = state->pc + WC_CURSH_SKIP(code);
 	    } else {
+		state->pc = s->u._subsh.end;
 		tindent--;
 		taddstr(" }");
 		stack = 1;

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


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

end of thread, other threads:[~2000-03-20 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-19 20:59 Infinite loop (?) in "typeset" Bart Schaefer
2000-03-20 10:56 Sven Wischnowsky
2000-03-20 18:17 ` Bart Schaefer

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