Bug 573936 - [PATCH] read in a ksh script in utf-8 locale does not restore tty settings
Summary: [PATCH] read in a ksh script in utf-8 locale does not restore tty settings
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: ksh
Version: 5.4
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: qe-baseos-tools
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-16 08:56 UTC by Tomas Smetana
Modified: 2018-11-26 19:39 UTC (History)
5 users (show)

Fixed In Version: ksh-20100621-1.el5
Doc Type: Bug Fix
Doc Text:
Clone Of: 572291
: 577223 (view as bug list)
Environment:
Last Closed: 2012-02-21 05:49:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0159 normal SHIPPED_LIVE ksh bug fix and enhancement update 2012-02-20 14:53:47 UTC

Description Tomas Smetana 2010-03-16 08:56:43 UTC
+++ This bug was initially created as a clone of Bug #572291 +++

Created an attachment (id=399158)
cook tty if operating in a multibyte environment (utf-8)

Description of problem:
When a read command is run in a ksh script and is allowed to time out, ksh fails to restore the tty settings. Due to this the terminal stops echoing characters anymore until it is reset. This happens only when the locale is set to something with utf-8 encoding (en_US.UTF-8 for example)

Version-Release number of selected component (if applicable):
ksh-20100309-1.fc14.x86_64

How reproducible:
Always

Steps to Reproduce:
Run the following script and wait for it to return:

##############################
#!/bin/ksh
TMOUT=5
read
##############################

Actual results:
Script returns after 5 seconds and the terminal no longer echoes key strokes

Expected results:
Script returns after 5 seconds and the terminal behaves normally

Additional info:
When running in a UTF-8 locale, ksh employs viraw mode to accept input, due to which the tty is made into a raw terminal with echo disabled. It does not however, restore the terminal on exit, leading to a tty which does not echo keystrokes. Attached patch fixes this.

Comment 2 Michal Hlavinka 2010-03-16 09:30:17 UTC
I can reproduce this.

Changing test script to:
#!/bin/ksh
set -o emacs
TMOUT=5
read

workarounds this problem (set -o vi can be used also)

I've already reported this upstream and we're discussing this issue now

Comment 4 RHEL Program Management 2010-08-09 18:20:40 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 6 RHEL Program Management 2011-01-11 20:22:27 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2011-01-11 22:42:40 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 8 RHEL Program Management 2011-05-31 13:20:47 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 10 Miroslav Franc 2011-08-24 10:43:57 UTC
Another reproducer:

##############################
#!/bin/ksh -i
TMOUT=5
read
##############################

Supposedly fixed versions in Rawhide (bug 572291) and RHEL6 (bug 577223) are still broken for this.

Comment 12 errata-xmlrpc 2012-02-21 05:49:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0159.html


Note You need to log in before you can comment on or make changes to this bug.