Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#101523: zsh segmentation fault



On Jun 19,  6:33pm, Clint Adams wrote:
}
} I can reproduce this with zsh --no-equals -fx shoop.sh

It's happening when the `=' parameter is (not) restored upon exit from the
function.  I'm not sure that's really the root cause, though.  Trace below.

I will point out that there's a rather nasty bug in shoop.sh on line 61:

    local orgargs="$@"

This will almost certainly not do what is wanted; it'll set orgargs to be
$1 and will make local variables whose names are the rest of the arguments.
Then later,

    set -- $orgargs

will also not produce the desired effect.

------------

BUG: in restoring special parameters
zsh: segmentation fault (core dumped)

zagzig<11> gdb Src/zsh core
GNU gdb 4.17.0.4 with Linux/x86 hardware watchpoint and FPU support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or 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.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `Src/zsh -o noequals -fx /home/schaefer/Mail/detach.dir/shoop.sh'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /usr/lib/libncurses.so.4...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.1...done.
#0  0x805f3c2 in restore_params (restorelist=0x40112580, removelist=0x40112588)
    at ../../zsh-4.0/Src/exec.c:2439
2439			tpm->flags = pm->flags;
(gdb) where
#0  0x805f3c2 in restore_params (restorelist=0x40112580, removelist=0x40112588)
    at ../../zsh-4.0/Src/exec.c:2439
#1  0x805eecc in execcmd (state=0xbffffaa8, input=0, output=0, how=18, last1=2)
    at ../../zsh-4.0/Src/exec.c:2315
#2  0x805bacb in execpline2 (state=0xbffffaa8, pcode=5699, how=18, input=0, 
    output=0, last1=0) at ../../zsh-4.0/Src/exec.c:1192
#3  0x805b043 in execpline (state=0xbffffaa8, slcode=11266, how=18, last1=0)
    at ../../zsh-4.0/Src/exec.c:982
#4  0x805a9dd in execlist (state=0xbffffaa8, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:826
#5  0x805a6f7 in execode (p=0x401122c8, dont_change_job=0, exiting=0)
    at ../../zsh-4.0/Src/exec.c:729
#6  0x806fcd5 in loop (toplevel=1, justonce=0) at ../../zsh-4.0/Src/init.c:160
#7  0x80724b4 in zsh_main (argc=5, argv=0xbffffb38)
    at ../../zsh-4.0/Src/init.c:1209
#8  0x804a8b4 in main (argc=5, argv=0xbffffb38) at ../../zsh-4.0/Src/main.c:37
(gdb) p pm
$1 = (struct param *) 0x40112590
(gdb) p *pm
$2 = {next = 0x40112568, nam = 0x8124bbc "=", flags = 786432, u = {
    data = 0x8137640, arr = 0x8137640, str = 0x8137640 " ", 
    val = 7309465757271946816, dval = 4.2633628668410461e+180, 
    hash = 0x8137640}, sets = {cfn = 0x998b646e, ifn = 0x998b646e, 
    ffn = 0x998b646e, afn = 0x998b646e, hfn = 0x998b646e}, gets = {cfn = 0x99, 
    ifn = 0x99, ffn = 0x99, afn = 0x99, hfn = 0x99}, unsetfn = 0, ct = 0, 
  env = 0x0, ename = 0x0, old = 0x0, level = 1074866392}
(gdb) p tpm
$3 = (struct param *) 0x0
(gdb) l
2434			Param tpm = (Param) paramtab->getnode(paramtab, pm->nam);
2435	
2436			DPUTS(!tpm || PM_TYPE(pm->flags) != PM_TYPE(tpm->flags) ||
2437			      !(pm->flags & PM_SPECIAL),
2438			      "BUG: in restoring special parameters");
2439			tpm->flags = pm->flags;
2440			switch (PM_TYPE(pm->flags)) {
2441			case PM_SCALAR:
2442			    tpm->sets.cfn(tpm, pm->u.str);
2443			    break;
(gdb) p pm->nam
$4 = 0x8124bbc "="

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

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author