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

Re: PATCH: parser (was: Re: PATCH: Improved _mailboxes)



This will probably be my last email for a while...

Sven Wischnowsky wrote:
> Here is the first of the two. As I said, this mainly makes the parser
> create wordcode directly, no more extra compilation phase.

I'm getting a core dump in zfinit from my .zshrc (after both patches, in
fact).  It's in text.c.  Actually, there seem to be two bugs there.  One
happens when a function is empty and you run `which' or equivalent:
getpermtext() calls gettext2() without realising that the prog.len is zero,
so it's only going to find garbage.  This must be because the code for
end-of-text is not being added, or if it was removed it's not being tested
enough.

I can't offhand see what's causing the second, but this seems to tickle it
on my system (although I only tried this after masking out the previous one
by putting an if (prog.len) before the call to gettext2()):

  chpwd() {
    if [[ ${+ZFTP_USER} = 1 && -n $ZFTP_USER ]]; then
      zftp_chpwd
    else
      [[ -t 1 && -t 2 ]] && header -P "%m:  %~";
    fi
  }
  which chpwd

causes a crash with a backtrace as follows, although it's probably more
useful to know that it seems to go wrong at the start of the second `[['.

#0  0x808d07f in taddstr (s=0x1e97c27d <Address 0x1e97c27d out of bounds>)
    at text.c:60
#1  0x808d154 in taddlist (state=0x7fffe000, num=3721) at text.c:81
#2  0x808d746 in gettext2 (state=0x7fffe000) at text.c:368
#3  0x808d246 in getpermtext (prog=0x80cd968, c=0x1) at text.c:126
#4  0x80667f8 in printshfuncnode (hn=0x80cd8e8, printflags=16)
    at hashtable.c:882
#5  0x80551aa in bin_whence (nam=0x2aac07d8 "which", argv=0x7ffff080, 
    ops=0x7ffff0d0 "", func=0) at builtin.c:2346
#6  0x8051bbd in execbuiltin (args=0x2aac07b8, bn=0x809d898) at builtin.c:367
#7  0x805df93 in execcmd (state=0x7ffff354, input=0, output=0, how=18, last1=2)
    at exec.c:2235
#8  0x805b9ef in execpline2 (state=0x7ffff354, pcode=579, how=18, input=0, 
    output=0, last1=0) at exec.c:1172
#9  0x805b235 in execpline (state=0x7ffff354, slcode=4098, how=18, last1=0)
    at exec.c:965
#10 0x805ad98 in execlist (state=0x7ffff354, dont_change_job=0, exiting=0)
    at exec.c:812
#11 0x805ab7a in execode (p=0x7fffe000, dont_change_job=0, exiting=135061469)
    at exec.c:721
#12 0x806a744 in loop (toplevel=1, justonce=0) at init.c:144
#13 0x80512ee in main (argc=2, argv=0x7ffff3f4) at ./main.c:86

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>



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