bug-readline
[Top][All Lists]
Advanced

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

Re: [Bug-readline] SIGSEGV in _rl_dispatch_callback()


From: Chet Ramey
Subject: Re: [Bug-readline] SIGSEGV in _rl_dispatch_callback()
Date: Mon, 10 Mar 2014 11:17:38 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 3/9/14 5:44 PM, address@hidden wrote:
> Hi,
> 
> (I'm not subscribed so I could not reply to the last message)
> 
> I could reproduce the issue by pressing delete twice in
> examples/rl-callbacktest.  After debugging the issue, I found that when
> the first delete is pressed, at some point at readline.c:747, r is -1 so
> it fails to call the RL_UNSETSTATE line.  After comparing with rl-6.2, I
> found the cause of the problem to be in readline.c:
>  rl_dispatching = 1;
>  RL_SETSTATE(RL_STATE_DISPATCHING);
> -(*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
> +r = (*func) (rl_numeric_arg * rl_arg_sign, key);
>  RL_UNSETSTATE(RL_STATE_DISPATCHING);
>  rl_dispatching = 0;
> 
> The dispatcher calls rl_delete() which calls rl_ding() and returns -1
> which gets stored as r and hence causes RL_STATE_MULTIKEY not to be set.
> In rl-6.2, rl_delete() also returns -1 but r is not stored so it
> doesn't fail.
> 
> I'm not sure as to the solution or why the change was made but it seems
> to be the cause of the problem.

Thanks; this is a great piece of debugging.  You pointed me to the right
place, and I was finally able to reproduce it on a convenient platform.

The problem is that the code uses -1 to mean two different things, but the
second use is only significant when the dispatch code notes that it has
read, or is reading, a multiple-key sequence.  That suggests the solution
to the DEL issue, which I've attached as a patch.  I will continue to look
at the previous-history/next-history issue.

Please let me know whether it fixes the various other problems on various
platforms.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

Attachment: readline-dispatch-multikey.patch
Description: Source code patch


reply via email to

[Prev in Thread] Current Thread [Next in Thread]