Under /bin/script, characters get printed in four-character chunks
Denis Excoffier
cygwin@Denis-Excoffier.org
Tue Mar 24 19:44:00 GMT 2015
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
More information about the Cygwin
mailing list