Bug 142538 - dialog tailboxbg changes terminal settings
Summary: dialog tailboxbg changes terminal settings
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: dialog
Version: 3.0
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2004-12-10 15:04 UTC by Stefan Kutzke
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-10-19 19:11:36 UTC
Target Upstream Version:

Attachments (Terms of Use)

Description Stefan Kutzke 2004-12-10 15:04:04 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20040803 Firefox/0.8

Description of problem:
After using dialog with a tailboxbg the terminal settings are not the
same as before. CR LF doesn't work, no typed characters are visible
and unicode support is disabled.

To see the problem, run a dialog sample script.
Enter directory /usr/share/doc/dialog-0.9b/samples
Run ./tailboxbg

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. cd /usr/share/doc/samples/dialog-0.9b7samples
2. ./tailboxbg
3. try to type commands

Actual Results:  CR LF doesn't work, no typed characters are visible
and unicode support is disabled

Expected Results:  The terminal settings should not beeing changed.

Additional info:

The machine was intalled with default settings, e.g.
language = en_US.UTF-8
terminal type = linux

After the samples script has finished I have to run the following
commands as a workaround:
1. reset
2. unicode_start

I can add these commands at the end of the script too :-)

Comment 1 Thomas E. Dickey 2004-12-21 00:28:55 UTC
I don't see that (on Debian/testing, built dialog against
ncursesw).  I pressed return to close the tailbox - seems
a little slow, but on exit the tty modes were working.

Perhaps you did a ^C and there's something wrong with
cleanup in that area (I checked for that, but a problem
there would be occasional if it happens - didn't see it).

Comment 2 Stefan Kutzke 2004-12-21 07:41:42 UTC
Maybe, I have the problem on Red Hat Enterprise Linux 3 as well as on
Fedora Core 1. Tailbox works, but not tailboxbg! I didn't a ^C.

Comment 3 Thomas E. Dickey 2004-12-21 12:15:53 UTC
Checking dialog's source, I'm not sure where a
normal exit (catching signals, etc) would produce
a problem.  It uses dlg_exit() for the actual
exit, and every place that would have initialized
the screen also calls end_dialog - which in turn
calls endwin.  In endwin, ncurses is supposed to
reset the tty modes.

If I were able to reproduce this problem, I would
first see what part of the above is not true -
whether dialog is indeed calling the given
functions and if the tty modes are not reset due
to some problem in ncurses or dialog.  Other than
by recompiling dialog to check this, the output
from ltrace should show the ncurses calls - it
it possible to get some insight from that trace:
we could see if endwin is called, and whether
the related ncurses tty mode functions are used.

Comment 4 Stefan Kutzke 2004-12-21 14:38:49 UTC
This is the original sample script
on my FC 1 machine.

# $Id: tailboxbg,v 1.5 2003/08/15 19:40:37 tom Exp $
: ${DIALOG=dialog}

tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

./killall listing
./listing >listing.out &

$DIALOG --title "TAIL BOX" \
    --no-kill \
    --tailboxbg listing.out 24 70 2>$tempfile

# wait a while for the background process to run
sleep 10

# now kill it
kill -3 `cat $tempfile` 2>&1 >/dev/null 2>/dev/null

# ...and the process that is making the listing
./killall listing

The dialog tailboxbg will be terminated by a SIGQUIT (kill -3).I have
tried other signals - same problem.

Comment 5 Harald Hoyer 2004-12-21 15:02:15 UTC
you could use "wait" and "kill %1"

Comment 6 Thomas E. Dickey 2004-12-21 16:30:46 UTC
I see (had forgotten a detail about the sample
script, and my quick check was too quick to get
caught by the timeout).  Adding a wait won't help
much since the executable won't necessarily exit
without some help.

But the executable does have a SIGQUIT handler - I
may have (will test) overlooked providing a path
for the leftover process to initialize curses so
it can restore the tty modes.

The leftover process is the loop at the end of

Comment 7 Thomas E. Dickey 2004-12-22 22:53:40 UTC
Other than that the dialog program doesn't reset tty
modes until it's killed (which the script does), I can't
find anything going wrong - to reproduce this report.
I can modify dialog to reset tty modes when it forks to
create the waiting process, but that won't let you type
while the script is running (though it would improve the
behavior of typeahead).  However the nature of the tailboxbg
is that it's expected to be the only process writing to the
screen (so there's limited usefulness there).

One detail that occurs to me:  if you use 'reset', it wipes
out the UTF-8 setting (that's a limitation of the Linux console).
I'd use "stty sane" instead (if you're seeing the tty modes not
restored), which would leave UTF-8 alone.

Comment 8 Thomas E. Dickey 2004-12-25 14:08:12 UTC
I added a reset for the tty modes to the most recent update to
dialog (20041222).

Comment 9 RHEL Program Management 2007-10-19 19:11:36 UTC
This bug is filed against RHEL 3, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products. Since
this bug does not meet that criteria, it is now being closed.
For more information of the RHEL errata support policy, please visit:
If you feel this bug is indeed mission critical, please contact your
support representative. You may be asked to provide detailed
information on how this bug is affecting you.

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