Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2006 05:26:13 GMT
From:      TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/92184: kterm, stty -a shows min = 0. this should be min = 1
Message-ID:  <200601230526.k0N5QDKL078060@www.freebsd.org>
Resent-Message-ID: <200601230530.k0N5U6HX064294@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         92184
>Category:       ports
>Synopsis:       kterm, stty -a shows min = 0. this should be min = 1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 23 05:30:05 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     TOMITA Yoshinori
>Release:        5.4-STABLE
>Organization:
>Environment:
FreeBSD palomino 5.4-STABLE FreeBSD 5.4-STABLE #0: Wed Apr  6 12:29:59 JST 2005     root@palomino:/usr/src/sys/i386/compile/Palomino  i386
>Description:
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
        -extproc
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

or

(for not to inherit terminal settings)
// from another host
ssh FreeBSD kterm
stty -a

>Fix:
--- main.c~     Mon Jan 23 12:24:03 2006
+++ main.c      Mon Jan 23 13:31:59 2006
@@ -1357,6 +1357,8 @@
        d_tio.c_cc[VDISCARD] = CFLUSH;
        d_tio.c_cc[VWERASE] = CWERASE;
        d_tio.c_cc[VLNEXT] = CLNEXT;
+       d_tio.c_cc[VMIN] = 1;
+       d_tio.c_cc[VTIME] = 0;
 #endif /* } */
 #ifdef TIOCSLTC /* { */
         d_ltc.t_suspc = CSUSP;         /* t_suspc */
@@ -1405,6 +1407,8 @@
        d_tio.c_cc[VQUIT] = CQUIT;              /* '^\' */
        d_tio.c_cc[VEOF] = CEOF;                /* '^D' */
        d_tio.c_cc[VEOL] = CEOL;                /* '^@' */
+       d_tio.c_cc[VMIN] = 1;
+       d_tio.c_cc[VTIME] = 0;
 #ifdef VSWTCH
        d_tio.c_cc[VSWTCH] = CSWTCH;            /* usually '^Z' */
 #endif

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601230526.k0N5QDKL078060>