From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60986 invoked by alias); 24 Mar 2015 18:59:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 60974 invoked by uid 89); 24 Mar 2015 18:59:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: smtp5-g21.free.fr Received: from smtp5-g21.free.fr (HELO smtp5-g21.free.fr) (212.27.42.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 24 Mar 2015 18:59:52 +0000 Received: from [192.168.0.11] (unknown [78.224.52.79]) by smtp5-g21.free.fr (Postfix) with ESMTP id 0B0FBD48087; Tue, 24 Mar 2015 19:58:18 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Under /bin/script, characters get printed in four-character chunks From: Denis Excoffier In-Reply-To: <20150228153035.GD11124@calimero.vinschen.de> Date: Tue, 24 Mar 2015 19:44:00 -0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <0B1779D1-F99A-4B3A-87FB-50AE581FD1B7@Denis-Excoffier.org> <20150228121357.GS11124@calimero.vinschen.de> <20150228153035.GD11124@calimero.vinschen.de> To: cygwin@cygwin.com X-SW-Source: 2015-03/txt/msg00434.txt.bz2 On 2015-02-28 16:30, Corinna Vinschen wrote: >=20 > On Feb 28 15:19, Denis Excoffier wrote: >> On 2015-02-28 13:13, Corinna Vinschen wrote: >>>=20 >>> On Feb 28 00:23, Denis Excoffier wrote: >>>> On 2015-02-27 18:52, Corinna Vinschen wrote: >>>>>=20 >>>>> I released another TEST version of the next upcoming Cygwin release. >>>>>=20 >>>> I have noticed that the behavior of /usr/bin/script is not better than >>>> previously (probably the change resides near >>>> https://cygwin.com/ml/cygwin-cvs/2015-q1/msg00094.html). >>>>=20 >>>> For at least several weeks, the behavior was ok, except for the >>>> Return key, which had to be hit several times to take effect. But the >>>> other characters were ok. >>>>=20 >>>> Now (after 2015-02-26), only every fourth character that i type >>>> is flushed to the command line, Return key included. For example, >>>> suppose that my command is "abcdefgh": only after i hit the 'd' key >>>> is "abcd" displayed, and only after i hit the 'h' key the >>>> "efgh" is displayed (the command line reads "abcdefgh"); now >>>> i have to hit four times the return key to "enter" the command. >>>>=20 >>>> Previously, the fourth-character-delay was probably already there, >>>> but only for the Return key. >>>=20 >>> I can't reproduce this. I started script, script starts my shell, and >>> then I can type and I see every character I type immediately, including >>> the ENTER key. I tried with SHELL set to /bin/tcsh as well as with >>> /bin/bash. >>>=20 >> Oops, forgot to mention: it is under xterm only. Under cmd.exe or under >> mintty, all is correct. >=20 > Since when do you see this problem? >=20 > I can not reproduce this in mintty, nor in a Cygwin xterm started on a > remote X server running under Linux. I can reproduce this with a local > xterm started via startxwin. But, and that's the problem, I can > reproduce it with the current 1.7.35-0.5 test release, with 1.7.34, and > last but not least also with a debug version of the Cygwin DLL in which I > backed out all PTY-related changes since last November. >=20 > I'm not sure this is a giveaway, but from that it seems this problem > is not directly related to a Cygwin change in the last months. >=20 > So, jturney and I are wondering when exactly you encountered this problem > for the first time. Did it coincide with a certain Cygwin release, > or a certain X server? Or new X libs, perhaps? >=20 > Anything you can provide to narrow down the potential culprit would be > helpful. >=20 Well. Here is some more inputs. This is connected with the "min" option of stty. When this occurs, 'stty -a' says '4' for min. If i change into 'stty min 5' the characters come by chunks of 5. I had a look into the sources of xterm, xinit, coreutils, tcsh and cygwin a= nd i definitely don't understand where the 4 comes from. In any case, 4 should= not be the problem, because 'stty min 4' is perfectly legitimate. The doc of stty says that 'min' (and 'time') are used in case of '-icanon'. However, i found in fhandler_tty.cc that it seems not to be always the case. After i applied the following patch: diff -uNr cygwin-snapshot-20150317-1.original/winsup/cygwin/fhandler_tty.cc= cygwin-snapshot-20150317-1.patched/winsup/cygwin/fhandler_tty.cc --- cygwin-snapshot-20150317-1.original/winsup/cygwin/fhandler_tty.cc 2015-= 03-17 11:42:16.000000000 +0100 +++ cygwin-snapshot-20150317-1.patched/winsup/cygwin/fhandler_tty.cc 2015-0= 3-24 19:32:42.000000000 +0100 @@ -715,7 +715,7 @@ =20 if (is_nonblocking () || !ptr) /* Indicating tcflush(). */ time_to_wait =3D 0; - else if ((get_ttyp ()->ti.c_lflag & ICANON)) + else if (!(get_ttyp ()->ti.c_lflag & ICANON)) time_to_wait =3D INFINITE; else { and the problem was gone. Let's try an explanation: the problem is present since "the beginning", at least since 2000-02-17, see https://cygwin.com/git/gitweb.cgi?p=3Dnewlib-cygwin.git;a=3Dblob;f=3Dwinsup= /cygwin/fhandler_tty.cc;hb=3D1fd5e000ace55b323124c7e556a7a864b972a5c4, and recent (2014-11-13) changes in fhandler_tty.cc made it to appear. Perhaps i'm also completely wrong. Hoping this will help, Regards, Denis Excoffier. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple