delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/24/15:00:13

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; q=dns; s=default; b=gP/g05QeEEZ84h6XpWgvxbflVCVF
6QVskshGcAeHm7PWMfc7Vf3fuOaPBZvmxEoQejXknbHFzFtn0KcyqjEYBDM4rJoE
KC4EKSUWTm1foexs5y4PDlugI3qmeH77pumWPXWV2Ed5qotaqJDV0W08o9feIrRL
SayW4pUyHEw0hTA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; s=default; bh=Vebne6TD/xUXudnh1WczeFHOJbE=; b=VI
SVdYWCms+lawg9+7ExnCXTLpiZsHRN5f3glRKI2GvWMvN6gkpgizk9s610kzscWw
oPMll8g/45KgI/JYfknyBnjTQuFFr8nVI39gTI2hsCwXwzIO0PTvkQk86WDrAc5X
EX1ysktigH+x3+dPZZrPN0xGqS0wTq6wW14utrOjA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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
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 <cygwin AT Denis-Excoffier DOT org>
In-Reply-To: <20150228153035.GD11124@calimero.vinschen.de>
Date: Tue, 24 Mar 2015 19:59:48 +0100
Message-Id: <A89DEE7E-11E1-408C-A44E-F5C98284AE48@Denis-Excoffier.org>
References: <announce DOT 20150227175205 DOT GP11124 AT calimero DOT vinschen DOT de> <0B1779D1-F99A-4B3A-87FB-50AE581FD1B7 AT Denis-Excoffier DOT org> <20150228121357 DOT GS11124 AT calimero DOT vinschen DOT de> <F4046FFA-03E6-4506-AEB9-BA4AF7C42EF9 AT Denis-Excoffier DOT org> <20150228153035 DOT GD11124 AT calimero DOT vinschen DOT de>
To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t2OJ08tK014640

On 2015-02-28 16:30, Corinna Vinschen wrote:
> 
> On Feb 28 15:19, Denis Excoffier wrote:
>> On 2015-02-28 13:13, Corinna Vinschen wrote:
>>> 
>>> On Feb 28 00:23, Denis Excoffier wrote:
>>>> On 2015-02-27 18:52, Corinna Vinschen wrote:
>>>>> 
>>>>> I released another TEST version of the next upcoming Cygwin release.
>>>>> 
>>>> 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).
>>>> 
>>>> 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.
>>>> 
>>>> 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.
>>>> 
>>>> Previously, the fourth-character-delay was probably already there,
>>>> but only for the Return key.
>>> 
>>> 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.
>>> 
>> Oops, forgot to mention: it is under xterm only. Under cmd.exe or under
>> mintty, all is correct.
> 
> Since when do you see this problem?
> 
> 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.
> 
> 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.
> 
> 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?
> 
> Anything you can provide to narrow down the potential culprit would be
> helpful.
> 
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 and
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-03-24 19:32:42.000000000 +0100
@@ -715,7 +715,7 @@
 
   if (is_nonblocking () || !ptr) /* Indicating tcflush(). */
     time_to_wait = 0;
-  else if ((get_ttyp ()->ti.c_lflag & ICANON))
+  else if (!(get_ttyp ()->ti.c_lflag & ICANON))
     time_to_wait = 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=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler_tty.cc;hb=1fd5e000ace55b323124c7e556a7a864b972a5c4,
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019