Bug 92184 - japanese/kterm, stty -a shows min = 0. this should be min = 1
Summary: japanese/kterm, stty -a shows min = 0. this should be min = 1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Norikatsu Shigemura
Depends on:
Reported: 2006-01-23 05:30 UTC by yoshint
Modified: 2006-06-21 09:10 UTC (History)
0 users

See Also:

file.diff (724 bytes, patch)
2006-01-23 05:30 UTC, yoshint
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yoshint 2006-01-23 05:30:05 UTC
a terminal opened by kterm shows like this:

% stty -a
speed 13 baud; 30 rows; 80 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
        -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff -ixany imaxbel ignbrk
        brkint -inpck -ignpar -parmrk
oflags: opost onlcr -ocrnl -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
        -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
        eol2 = <undef>; erase = ^H; erase2 = ^@; intr = ^?; kill = ^U;
        lnext = ^V; min = 0; quit = ^\; reprint = ^R; start = ^Q;
        status = ^@; stop = ^S; susp = ^Z; time = 0; werase = ^W;

We can see "min = 0".
This may causes troubles for software using non-canonical mode.

While xterm initialises min = 1, kterm does not.

For example, min = 0 makes ports/japanese/ng, a simple text editor,
 busy loop in reading keyboard input from standard input.

From ng-1.4.4/ttyio.c
	while (read(0, &buf[0], 1) != 1)

We can also say ng-1.4.4 is buggy because it uses old tty interface and not setting VMIN parameter.

ports/japanese/ng-devel is OK in this point.

How-To-Repeat: kterm
stty -a


(for not to inherit terminal settings)
// from another host
ssh FreeBSD kterm
stty -a
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2006-06-21 04:06:53 UTC
State Changed
From-To: open->feedback

To which port does this Problem Report apply?
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2006-06-21 07:28:23 UTC
State Changed
From-To: feedback->open

Feedback received.
Comment 3 Norikatsu Shigemura freebsd_committer 2006-06-21 07:39:16 UTC
Responsible Changed
From-To: freebsd-ports-bugs->nork

I'll handle this.
Comment 4 Norikatsu Shigemura freebsd_committer 2006-06-21 07:56:52 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 5 yoshin-t 2006-06-21 09:01:38 UTC
(some more additional information)

kterm and also xterm will inherit the current terminal setting where
k(x)term invoked.

I often saw MIN=0 because I use ssh to launch kterm.

% ssh SOMEHOST kterm -display MYHOST:0

In this case, ssh will not allocate pseudo-tty. kterm cannot inherit
terminal setting and it results in MIN=0.
// with "-t", ssh can forcibly allocate ptty.

I checked on debian Linux's kterm port and found no MIN=0 problem. This
is because that #if defined(linux) block in original kterm
implementation makes a new psuedo terminal be always initialized with
default values and never inheritating.

In main.c, a variable tio is initialized here and tio.c_cc[VMIN]
becomes 1 (default value?).

* set up the tty modes
#if defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)
#if defined(umips) || defined(CRAY) || defined(linux)
/* If the control tty had its modes screwed around with,
eg. by lineedit in the shell, or emacs, etc. then tio
will have bad values. Let's just get termio from the
new tty and tailor it. */
if (ioctl (tty, TCGETA, &tio) == -1)
tio.c_lflag |= ECHOE;
#endif /* umips */