On 5/22/14, 10:19 PM, Linda Walsh wrote:

>> We're mostly talking about the
>> interaction between readline and the applications that use it. 
> ----
>     I'm not sure I see the problem there -- since the application
> runs "after bash" (i.e. bash forks&execs it, then waits for it to return
> in the normal foreground case), wouldn't the application be able to
> install whatever signal handling it wants and possibly interfere w/bash
> getting the signal, vs. bash causing app interferences?

I think you misunderstand.  Applications, in this context, are those
programs that link with readline and use it for command line editing.
Bash is an application from readline's perspective.  Readline has to
manage its signal handling in a way that doesn't preclude an application
that links with it from doing what it needs.

>> While
>> you can use readline in a script -- and there is a pending bug with
>> readline and timeouts in scripts when called by the read builtin -- it's
>> not the primary use case.  And SIGWINCH is the only signal subject to
>> this problem.
> ---
> 
> Wait.. there is a pending bug w/readline and timeouts, (i.e. SIGALARM?) and
> SIGWINCH is the only one -- is the bug w/readline & timeouts, or only
> in the presence of SIGWINCH?  

It has to do with the read builtin not setting the right hook for readline
and readline not doing what it needs to with SIGALRM.  It's not anything
related to the framework or approach, and unconnected to any SIGWINCH
issues except that they are both signals.

I've attached the sample patch so you can see what I'm talking about.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.3-patched/lib/readline/input.c	2014-01-10 15:07:08.000000000 -0500
--- lib/readline/input.c	2014-05-22 18:40:59.000000000 -0400
***************
*** 535,540 ****
--- 538,551 ----
        else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
  	return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+       /* keyboard-generated signals of interest */
        else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
          RL_CHECK_SIGNALS ();
+       /* non-keyboard-generated signals of interest */
+       else if (_rl_caught_signal == SIGALRM
+ #if defined (SIGVTALRM)
+ 		|| _rl_caught_signal == SIGVTALRM
+ #endif
+ 	      )
+         RL_CHECK_SIGNALS ();
  
        if (rl_signal_event_hook)
*** ../bash-4.3-patched/builtins/read.def	2013-09-02 11:54:00.000000000 -0400
--- builtins/read.def	2014-05-08 11:43:35.000000000 -0400
***************
*** 443,447 ****
  #if defined (READLINE)
        if (edit)
! 	add_unwind_protect (reset_attempted_completion_function, (char *)NULL);
  #endif
        falarm (tmsec, tmusec);
--- 443,450 ----
  #if defined (READLINE)
        if (edit)
! 	{
! 	  add_unwind_protect (reset_attempted_completion_function, (char *)NULL);
! 	  add_unwind_protect (bashline_reset_event_hook, (char *)NULL);
! 	}
  #endif
        falarm (tmsec, tmusec);
***************
*** 1022,1025 ****
--- 1025,1029 ----
    old_attempted_completion_function = rl_attempted_completion_function;
    rl_attempted_completion_function = (rl_completion_func_t *)NULL;
+   bashline_set_event_hook ();
    if (itext)
      {
***************
*** 1033,1036 ****
--- 1037,1041 ----
    rl_attempted_completion_function = old_attempted_completion_function;
    old_attempted_completion_function = (rl_completion_func_t *)NULL;
+   bashline_reset_event_hook ();
  
    if (ret == 0)

Reply via email to