[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in bre
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list
Mon, 18 Dec 2006 15:09:19 -0500
Thunderbird 22.214.171.124 (Macintosh/20061025)
Jan Kratochvil wrote:
> On Sun, 03 Dec 2006 06:25:29 +0100, Chet Ramey wrote:
>> More appropriate in the sense that the application controls the state
>> and switches between the callback and synchronous readline modes.
>> Since it's the app that's supposed to be calling into readline when in
>> callback mode anyway, I think this patch will work better.
> Chet, is it right it is more a design than implementation problem of readline?
> readline cannot determine how many nested readline calls have been abandoned
> signal handler's longjmp (). Therefore it cannot determine if the current
> (the last unabandoned call) is a callback or synchronous one.
Not exactly. The callback and traditional calling mechanisms are
orthogonal. It's just not safe to mix them. The longjmp leaves
readline in an inconsistent state, unless the calling application is
careful to undo what state-setting it has done. That's the part
readline can't know about: the appropriate application-specific part.
> The sample code should be readline documentation compliant, still the called
> function `_rl_next_macro_key' has undeterministic value of
> `RL_ISSTATE (RL_STATE_CALLBACK)'.
OK, you got me. I'll fix that one, if I can find it. I can't find a call
to that function in the examples/ or doc/ directories.
> Also any longjmp () from inside a signal handler is too dangerous as the data
> structures are not locked against signals. The signal handler should only set
> some flag. And the synchronous readline () function should be never used if
> one needs to quit the input mode by SIGINT (as one cannot abort readline () if
> not using the dangerous longjmp ()).
Sure, in theory. Pragmatically, however, it's not that bad. We're just
talking about not mixing the two calling modes, since readline alters its
behavior (and makes certain assumptions) based on the current mode.
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
[Bug-readline] Re: PATCH: PR tui/2173: Arrow keys no longer works in breakpoint command list, Daniel Jacobowitz, 2006/12/04