bug-bash
[Top][All Lists]
Advanced

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

Re: Terminal state with read -st1


From: Chet Ramey
Subject: Re: Terminal state with read -st1
Date: Mon, 02 Mar 2009 10:18:52 -0500
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Chris F.A. Johnson wrote:
> In bash4.0, the terminal is not reset if this is times out:
> 
> read -st1

Thanks for the report.  The cleanup functions were not called on timeout.
The attached patch fixes things for me.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/
*** ../bash-4.0/builtins/read.def       2009-01-15 23:11:21.000000000 -0500
--- builtins/read.def   2009-03-02 10:15:39.000000000 -0500
***************
*** 370,381 ****
        if (code)
        {
! #if 0
          run_unwind_frame ("read_builtin");
-         return (EXECUTION_FAILURE);
- #else
          input_string[i] = '\0';       /* make sure it's terminated */
!         retval = 128+SIGALRM;;
          goto assign_vars;
- #endif
        }
        old_alrm = set_signal_handler (SIGALRM, sigalrm);
--- 370,381 ----
        if (code)
        {
!         /* Tricky.  The top of the unwind-protect stack is the free of
!            input_string.  We want to run all the rest and use input_string,
!            so we have to remove it from the stack. */
!         remove_unwind_protect ();
          run_unwind_frame ("read_builtin");
          input_string[i] = '\0';       /* make sure it's terminated */
!         retval = 128+SIGALRM;
          goto assign_vars;
        }
        old_alrm = set_signal_handler (SIGALRM, sigalrm);

reply via email to

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