Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libedit trouble



On Fri, Feb 20, 2009 at 06:29:25PM +0000, Christos Zoulas wrote:
> In article <20090219200933.GB29459%shaak.vert-toit.net@localhost>,
> Quentin Garnier  <cube%cubidou.net@localhost> wrote:
> >-=-=-=-=-=-
> >
> >On Thu, Feb 19, 2009 at 06:56:27PM +0000, Patrick Welche wrote:
> >> Using "bc" as the libedit using test programme,
> >> 
> >> Core was generated by `bc'.
> >> Program terminated with signal 11, Segmentation fault.
> >> #0  0xbb934070 in ?? ()
> >> (gdb) bt
> >> #0  0xbb934070 in ?? ()
> >> #1  0xbbbd58e7 in prompt_print (el=0xbb90cc00, op=0)
> >>     at /usr/src/lib/libedit/prompt.c:95
> >> #2  0xbbbd6aed in re_refresh (el=0xbb90cc00)
> >>     at /usr/src/lib/libedit/refresh.c:220
> >> #3  0xbbbd609b in read_prepare (el=0xbb90cc00)
> >>     at /usr/src/lib/libedit/read.c:394
> >> #4  0xbbbd624a in el_gets (el=0xbb90cc00, nread=0x80584a0)
> >>     at /usr/src/lib/libedit/read.c:466
> >> #5  0x0804fd59 in yy_get_next_buffer ()
> >> #6  0x08050207 in yylex ()
> >> #7  0x08049512 in yyparse ()
> >> #8  0x0804cbcb in main ()
> >> 
> >> frame 1 el contains
> >> 
> >> el_prompt = {
> >>     p_func = 0xbb934070, p_pos = {h = 0, v = 0}, p_arg = 0x804f570}, 
> >>   el_rprompt = {p_func = 0xbbbd58a0 <prompt_default_r>, p_pos = {h = 0, 
> >>       v = 0}, p_arg = 0x0}
> >> 
> >> Not obvious what's up...
> >
> >If I make bc call el_set (edit, EL_PROMPT, null_prompt, NULL) like I
> >think it should now, it doesn't dump core anymore, but it displays the
> >'?' prompt...
> 
> Crap, I thought that the last argument was guaranteed to be null varyadic
> functions.

That might be true, I have no clue about that.  The problem here was
that the va_arg() calls were evaluated in the wrong order.  The extra
va_arg() call might still be an issue, I'll let the C lawyers discuss.

-- 
Quentin Garnier - cube%cubidou.net@localhost - cube%NetBSD.org@localhost
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgp6KWke1Yhi6.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index