File ksh93-tty.dif of Package ksh

> Hi,
> 
> one our user has reported an issue with wrong tty state after timed out read, 
> when using utf-8 locale. The reproducer is:
> 
> cat >test.sh <<EOF
> #!/bin/ksh
> TMOUT=5
> read
> EOF
> 
> chmod +x test.sh
> ./test.sh
> 
> Actual result (after letting read to time out) is tty does not echo any input 
> until terminal is reset. Reporter provided a patch (attached) to fix this.
> 

A work around is to out
	set -o vi
or
	set -g emacs
before the read.

I have enclosed the change that I made to fixe this problem below.

--- src/cmd/ksh93/sh/fault.c	2010-01-18 11:11:18.000000000 +0000
+++ src/cmd/ksh93/sh/fault.c	2010-03-12 16:18:41.000000000 +0000
@@ -614,7 +614,7 @@ void sh_done(void *ptr, register int sig
 	sh_accend();
 #endif	/* SHOPT_ACCT */
 #if SHOPT_VSH || SHOPT_ESH
-	if(sh_isoption(SH_EMACS)||sh_isoption(SH_VI)||sh_isoption(SH_GMACS))
+	if(mbwide()||sh_isoption(SH_EMACS)||sh_isoption(SH_VI)||sh_isoption(SH_GMACS))
 		tty_cooked(-1);
 #endif
 #ifdef JOBS
openSUSE Build Service is sponsored by