* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
[not found] ` <k@anna.in-berlin.de>
1996-07-06 16:24 ` Bart Schaefer
@ 1996-07-07 16:16 ` Bart Schaefer
1996-07-07 17:28 ` Andreas Koenig
1996-07-08 0:57 ` Zoltan Hidvegi
1 sibling, 2 replies; 9+ messages in thread
From: Bart Schaefer @ 1996-07-07 16:16 UTC (permalink / raw)
To: andreas.koenig; +Cc: zsh-workers
On Jul 7, 12:50pm, Andreas Koenig wrote:
} Subject: Re: zsh-3.0-pre2 cores on irix 5.3 (?)
}
} I started investigating, and reduced the bug (see below)
}
} > 1. Do you start getting the `alloc_stackp != 0' error immediately upon
} > starting zsh? Or only after doing some completions? Or only after
} > the periodic function starts firing?
}
} Immediately after starting and then every $PERIOD seconds.
}
} Here's my current .zshrc:
}
} PERIOD=1800
} periodic () { . $HOME/.zlogout }
}
} Here's my .zlogout:
}
} echo "In .zprofile 1"
} #dirs >! $HOME/.zdirhistory
} #echo -n ^[]1\;$USERNAME@$HOST\a^[]2\;$USERNAME@$HOST $$\a
}
} You see the lines it had before commented out. It turns out that ANY
} command in the file triggers _one_ alloc_stackp message.
Turns out that "source" or "." inside any shell function will trigger
that BUG warning, which isn't really a bug at all -- it's doshfunc()
calling loop() recursively, so the allocation stack depth reflects the
depth of recursion.
zagzig<3> echo echo foo > foo
zagzig<4> blat() { . foo }
zagzig<5> blat
foo
BUG: alloc_stackp != 0 in loop()
zagzig<6>
The for(;;) in loop() continues before reaching the DPUTS() call on any
blank or commented line, which is why I didn't see it when I first tried
to reproduce it, and which is why you see it once for each command.
Try this patch.
*** Src/init.c.orig Fri Jul 5 10:57:45 1996
--- Src/init.c Sun Jul 7 09:07:57 1996
***************
*** 128,134 ****
if (toplevel)
noexitct = 0;
}
! DPUTS(alloc_stackp, "BUG: alloc_stackp != 0 in loop()");
if (ferror(stderr)) {
zerr("write error", NULL, 0);
clearerr(stderr);
--- 128,134 ----
if (toplevel)
noexitct = 0;
}
! DPUTS(alloc_stackp > locallevel, "BUG: alloc_stackp > locallevel in loop()");
if (ferror(stderr)) {
zerr("write error", NULL, 0);
clearerr(stderr);
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-07 16:16 ` Bart Schaefer
@ 1996-07-07 17:28 ` Andreas Koenig
1996-07-08 0:57 ` Zoltan Hidvegi
1 sibling, 0 replies; 9+ messages in thread
From: Andreas Koenig @ 1996-07-07 17:28 UTC (permalink / raw)
To: schaefer; +Cc: zsh-workers
>>>>> Bart Schaefer writes:
bart> Try this patch.
bart> *** Src/init.c.orig Fri Jul 5 10:57:45 1996
bart> --- Src/init.c Sun Jul 7 09:07:57 1996
Thanks Bart, the patch--of course--does the trick.
andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-07 16:16 ` Bart Schaefer
1996-07-07 17:28 ` Andreas Koenig
@ 1996-07-08 0:57 ` Zoltan Hidvegi
1996-07-08 7:37 ` Zefram
1 sibling, 1 reply; 9+ messages in thread
From: Zoltan Hidvegi @ 1996-07-08 0:57 UTC (permalink / raw)
To: schaefer; +Cc: andreas.koenig, zsh-workers
> Turns out that "source" or "." inside any shell function will trigger
> that BUG warning, which isn't really a bug at all -- it's doshfunc()
> calling loop() recursively, so the allocation stack depth reflects the
> depth of recursion.
The allocation stack can be deeper than locallevel in loop() when source
is used inside a command substitution or when source is called from a
trap. So the patch below is more correct that Bart's patch. Note that
in the main top level loop alloc_stackp should always be zero.
Zoltan
rcsdiff -qc -kk -r2.23 -r2.24 Src/init.c
*** Src/init.c
--- Src/init.c 1996/07/07 16:03:48 2.24
***************
*** 101,106 ****
--- 101,109 ----
loop(int toplevel)
{
List list;
+ #ifdef DEBUG
+ int oasp = toplevel ? 0 : alloc_stackp;
+ #endif
pushheap();
for (;;) {
***************
*** 128,134 ****
if (toplevel)
noexitct = 0;
}
! DPUTS(alloc_stackp, "BUG: alloc_stackp != 0 in loop()");
if (ferror(stderr)) {
zerr("write error", NULL, 0);
clearerr(stderr);
--- 131,137 ----
if (toplevel)
noexitct = 0;
}
! DPUTS(alloc_stackp != oasp, "BUG: alloc_stackp changed in loop()");
if (ferror(stderr)) {
zerr("write error", NULL, 0);
clearerr(stderr);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-08 0:57 ` Zoltan Hidvegi
@ 1996-07-08 7:37 ` Zefram
1996-07-08 14:54 ` Zoltan Hidvegi
0 siblings, 1 reply; 9+ messages in thread
From: Zefram @ 1996-07-08 7:37 UTC (permalink / raw)
To: Zoltan Hidvegi; +Cc: Z Shell workers mailing list
>+ #ifdef DEBUG
>+ int oasp = toplevel ? 0 : alloc_stackp;
>+ #endif
Huh? If we're at the top level, alloc_stackp is 0 anyway. Even if
there are bugs, it's 0 at this point -- the beginning of the function.
Or can loop() be called more than once with toplevel!=0?
-zefram
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-08 7:37 ` Zefram
@ 1996-07-08 14:54 ` Zoltan Hidvegi
0 siblings, 0 replies; 9+ messages in thread
From: Zoltan Hidvegi @ 1996-07-08 14:54 UTC (permalink / raw)
To: Zefram; +Cc: zsh-workers
> >+ #ifdef DEBUG
> >+ int oasp = toplevel ? 0 : alloc_stackp;
> >+ #endif
>
> Huh? If we're at the top level, alloc_stackp is 0 anyway. Even if
> there are bugs, it's 0 at this point -- the beginning of the function.
> Or can loop() be called more than once with toplevel!=0?
run_init_scripts() is called before loop(1) which can mess up alloc_stackp.
Also debug tests should notice even seemingly impossible bugs. Signal
traps can always cause surprises. E.g. in execcmd() _very_ weird things
happened before introducing execsave()/execrestore() in dotrap(). For
example variables suddenly changed between two instructions. Of course
this can still happen any time a global or static variable is used but now
it does not happen as often as before.
Zoltan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-06 17:29 ` Zoltan Hidvegi
@ 1996-07-06 21:32 ` Andreas Koenig
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Koenig @ 1996-07-06 21:32 UTC (permalink / raw)
To: hzoli; +Cc: zsh-workers
Thanks, Bart and Zoltan,
with the two chunks of patches you sent me, the core is gone, but I
get
k@anna:/usr/sources/shells/zsh-3.0-pre2% exec Src/zsh
BUG: alloc_stackp != 0 in loop()
BUG: alloc_stackp != 0 in loop()
instead. Let me know, if need additional info,
andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
1996-07-06 16:24 ` Bart Schaefer
@ 1996-07-06 17:29 ` Zoltan Hidvegi
1996-07-06 21:32 ` Andreas Koenig
0 siblings, 1 reply; 9+ messages in thread
From: Zoltan Hidvegi @ 1996-07-06 17:29 UTC (permalink / raw)
To: schaefer; +Cc: andreas.koenig, zsh-workers
Bart wrote:
> On Jul 6, 1:52pm, Andreas Koenig wrote:
> } Subject: zsh-3.0-pre2 cores on irix 5.3 (?)
> }
> } As I had to rebuild my whole irix 5.3 from both CDROM and backup
> } tapes, this may be a due to a misconfiguration of my
> } machine. Nonetheless, recompiling beta19 works, pre2 results in a
> } core.
> }
> } exec.c: In function `execcmd':
> } exec.c:1318: warning: format argument is not a pointer (arg 3)
>
> That (and the core dump) are almost certainly from the DPUTS() typo
> that someone (Wayne?) already reported:
That patch from Wayne also containd a patch to signals.c. If int and pid_t
are different it may be the problem. For me, with these patches it works:
digo ~ % uname -a
IRIX digo 5.3 11091812 IP22 mips
digo ~ % echo $ZSH_VERSION
3.0-pre2
Zoltan
--- Src/signals.c 1996/07/04 19:40:08 2.12
+++ Src/signals.c 1996/07/05 20:52:22 2.13
@@ -464,7 +464,7 @@
Job jn;
Process pn;
pid_t pid;
- int *procsubpid = &cmdoutpid;
+ pid_t *procsubpid = &cmdoutpid;
int *procsubval = &cmdoutval;
struct execstack *es = exstack;
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: zsh-3.0-pre2 cores on irix 5.3 (?)
[not found] ` <k@anna.in-berlin.de>
@ 1996-07-06 16:24 ` Bart Schaefer
1996-07-06 17:29 ` Zoltan Hidvegi
1996-07-07 16:16 ` Bart Schaefer
1 sibling, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 1996-07-06 16:24 UTC (permalink / raw)
To: andreas.koenig, zsh-workers
On Jul 6, 1:52pm, Andreas Koenig wrote:
} Subject: zsh-3.0-pre2 cores on irix 5.3 (?)
}
} As I had to rebuild my whole irix 5.3 from both CDROM and backup
} tapes, this may be a due to a misconfiguration of my
} machine. Nonetheless, recompiling beta19 works, pre2 results in a
} core.
}
} exec.c: In function `execcmd':
} exec.c:1318: warning: format argument is not a pointer (arg 3)
That (and the core dump) are almost certainly from the DPUTS() typo
that someone (Wayne?) already reported:
--- zsh-3.0-pre2/Src/zsh.h Fri Jul 5 10:57:49 1996
+++ zsh-3.0-pre2-fix/Src/zsh.h Fri Jul 5 11:25:44 1996
@@ -1307,7 +1307,7 @@
#ifdef DEBUG
# define DPUTS(X,Y) if (!(X)) {;} else \
- fprintf(stderr, "%s\n", X), fflush(stderr)
+ fprintf(stderr, "%s\n", Y), fflush(stderr)
# define MUSTUSEHEAP(X) if (useheap) {;} else \
fprintf(stderr, "BUG: permanent allocation in %s\n", X), \
fflush(stderr)
} #3 0x45db7c in loop (toplevel=0) at init.c:131
That line is this call:
DPUTS(alloc_stackp, "BUG: alloc_stackp != 0 in loop()");
So apparently our allocation problems aren't all over with, yet.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
^ permalink raw reply [flat|nested] 9+ messages in thread
* zsh-3.0-pre2 cores on irix 5.3 (?)
@ 1996-07-06 11:52 Andreas Koenig
[not found] ` <k@anna.in-berlin.de>
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Koenig @ 1996-07-06 11:52 UTC (permalink / raw)
To: zsh-workers
As I had to rebuild my whole irix 5.3 from both CDROM and backup
tapes, this may be a due to a misconfiguration of my
machine. Nonetheless, recompiling beta19 works, pre2 results in a
core.
Excerpts from the compilation:
zsh configuration
-----------------
zsh version : 3.0-pre2
host operating system : irix5.3
source code location : .
compiler : gcc
compiler flags : -Wall -Wno-implicit -Wmissing-prototypes -DDEBUG -g
binary install path : /usr/local/bin
man page install path : /usr/local/man
info install path : /usr/local/info
exec.c: In function `execcmd':
exec.c:1318: warning: format argument is not a pointer (arg 3)
exec.c: In function `execrestore':
exec.c:2590: warning: format argument is not a pointer (arg 3)
init.c: In function `loop':
init.c:131: warning: format argument is not a pointer (arg 3)
lex.c: In function `lexsave':
lex.c:85: warning: format argument is not a pointer (arg 3)
lex.c: In function `gettok':
lex.c:516: warning: format argument is not a pointer (arg 3)
lex.c: In function `gettokstr':
lex.c:994: warning: format argument is not a pointer (arg 3)
lex.c: In function `parsestr':
lex.c:1158: warning: format argument is not a pointer (arg 3)
lex.c: In function `parse_subst_string':
lex.c:1203: warning: format argument is not a pointer (arg 3)
signals.c: In function `unqueue_signals':
signals.c:388: warning: format argument is not a pointer (arg 3)
signals.c: In function `handler':
signals.c:444: warning: format argument is not a pointer (arg 3)
signals.c:467: warning: initialization from incompatible pointer type
signals.c:492: warning: assignment from incompatible pointer type
subst.c: In function `paramsubst':
subst.c:669: warning: format argument is not a pointer (arg 3)
text.c: In function `getredirs':
text.c:485: warning: format argument is not a pointer (arg 3)
text.c:490: warning: format argument is not a pointer (arg 3)
zle_tricky.c: In function `doexpansion':
zle_tricky.c:1192: warning: format argument is not a pointer (arg 3)
zle_tricky.c: In function `doexpandhist':
zle_tricky.c:3817: warning: format argument is not a pointer (arg 3)
zle_tricky.c: In function `getcurcmd':
zle_tricky.c:3901: warning: format argument is not a pointer (arg 3)
k@anna:/usr/sources/shells/zsh-3.0-pre2% Src/zsh
zsh: segmentation fault (core dumped) Src/zsh
k@anna:/usr/sources/shells/zsh-3.0-pre2% gdb Src/zsh core
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.15.1 (mips-sgi-irix5.3), Copyright 1995 Free Software Foundation, Inc...
Core was generated by `zsh'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libcurses.so...done.
Reading symbols from /usr/lib/libc.so.1...done.
#0 strlen () at strlen.s:15
strlen.s:15: No such file or directory.
(gdb) bt
#0 strlen () at strlen.s:15
#1 0xfabe3bc in _doprnt () at doprnt.c:1588
#2 0xfac7ffc in fprintf () at fprintf.c:45
#3 0x45db7c in loop (toplevel=0) at init.c:131
#4 0x461258 in source (s=0x1003bcf0 "/usr/people/k/.zlogout") at init.c:780
#5 0x42a170 in bin_dot (name=0x1001b31c ".", argv=0x1001b3b8,
ops=0x7fffaa68 "", func=0) at builtin.c:4641
#6 0x410f7c in execbuiltin (args=0x1001b314, bn=0x100015f0) at builtin.c:189
#7 0x43b8dc in execcmd (cmd=0x1001b2f4, input=0, output=0, how=2, last1=2)
at exec.c:1604
#8 0x43622c in execpline2 (pline=0x1001b36c, how=2, input=0, output=0,
last1=0) at exec.c:781
#9 0x43516c in execpline (l=0x1001b358, how=2, last1=0) at exec.c:627
#10 0x4349b8 in execlist (list=0x1001b348, dont_change_job=1, exiting=0)
at exec.c:508
#11 0x4402ec in doshfunc (list=0x10020418, doshargs=0x0, flags=0,
noreturnval=1) at exec.c:2420
#12 0x49f1d0 in preprompt () at utils.c:581
#13 0x45d960 in loop (toplevel=1) at init.c:110
#14 0x45d6e8 in main (argc=1, argv=0x7fffaf14) at init.c:77
Current language: auto; currently asm
(gdb)
Hope, that helps,
let me know, if you need additional info,
andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1996-07-08 15:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-06 11:52 zsh-3.0-pre2 cores on irix 5.3 (?) Andreas Koenig
[not found] ` <k@anna.in-berlin.de>
1996-07-06 16:24 ` Bart Schaefer
1996-07-06 17:29 ` Zoltan Hidvegi
1996-07-06 21:32 ` Andreas Koenig
1996-07-07 16:16 ` Bart Schaefer
1996-07-07 17:28 ` Andreas Koenig
1996-07-08 0:57 ` Zoltan Hidvegi
1996-07-08 7:37 ` Zefram
1996-07-08 14:54 ` Zoltan Hidvegi
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).