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

Re: segfault in 4.1.1-test-2 [now with a different param expansion]

On Wed, May 21, 2003 at 05:03:39PM +0100, Peter Stephenson wrote:
> I *hate* that function.

Heh. For me, even the manual page is more than enough.  So thanks!

Since the iron is hot, however...  see below  :-)

I'm probably missing something obvious here - At the point of the fault,
parameter 'a' of nstrpcmp is null, however it looks to me like it's
outside the range of the qsort??!  Maybe I don't believe the
debugger. Anyhow, both gcc 3.3 and Sun C v5 show the same behaviour,
but I couldn't reproduce the fault on Linux.  Also, though
the implications seem a bit odd, overriding qsort using
LD_PRELOAD seems to avoid the crash.

Again, let me know if I should to do more investigation.




fires-02% gdb Src/zsh
GNU gdb 5.3
Copyright 2002 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 "sparc-sun-solaris2.8"...
(gdb) run
Starting program: /tmp/zsh-4.1.1-test-2/Src/zsh 
fires-02% cd /tmp
fires-02% cat numbers
fires-02% x=($(<numbers))
fires-02% echo ${(no)x}

Program received signal SIGSEGV, Segmentation fault.
0xff15c1b0 in __strcoll_std () from /usr/lib/libc.so.1
(gdb) where
#0  0xff15c1b0 in __strcoll_std () from /usr/lib/libc.so.1
#1  0x000a86b4 in nstrpcmp (a=0xff1e01dc, b=0xff1e01ec) at subst.c:550
#2  0xff14b07c in qsort () from /usr/lib/libc.so.1
#3  0x000af434 in paramsubst (l=0xff1e01a8, n=0xff1e01bc, str=0xffbed71c, qt=0, ssub=0) at subst.c:1991
#4  0x000a69b4 in stringsubst (list=0xff1e01a8, node=0xff1e01bc, ssub=0, asssub=0) at subst.c:137
#5  0x000a61d0 in prefork (list=0xff1e01a8, flags=1) at subst.c:74
#6  0x000331dc in execcmd (state=0xffbedc48, input=0, output=0, how=18, last1=2) at exec.c:1796
#7  0x00030cb0 in execpline2 (state=0xffbedc48, pcode=323, how=18, input=0, output=0, last1=0) at exec.c:1228
#8  0x0002fa78 in execpline (state=0xffbedc48, slcode=4098, how=18, last1=0) at exec.c:1018
#9  0x0002eec0 in execlist (state=0xffbedc48, dont_change_job=0, exiting=0) at exec.c:829
#10 0x0002e9d8 in execode (p=0xff1e0150, dont_change_job=0, exiting=0) at exec.c:730
#11 0x000545d4 in loop (toplevel=1, justonce=0) at init.c:167
#12 0x000587b4 in zsh_main (argc=1, argv=0xffbede54) at init.c:1239
#13 0x0001273c in main (argc=1, argv=0xffbede54) at main.c:37
(gdb) frame 3
#3  0x000af4d4 in paramsubst (l=0xff1e05a8, n=0xff1e05bc, str=0xffbed71c, qt=0, ssub=0) at subst.c:1998
1998                        qsort(aval, i, sizeof(char *), sortfn[sortit-1]);
(gdb) print aval
$32 = (char **) 0xff1e05e0
(gdb) print i
$33 = 15

This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.

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