public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: X server sets VMIN? (was Re: Under /bin/script, characters get printed in four-character chunks)
Date: Tue, 24 Mar 2015 20:29:00 -0000	[thread overview]
Message-ID: <20150324195339.GA32703@calimero.vinschen.de> (raw)
In-Reply-To: <A89DEE7E-11E1-408C-A44E-F5C98284AE48@Denis-Excoffier.org>

[-- Attachment #1: Type: text/plain, Size: 3247 bytes --]

On Mar 24 19:59, Denis Excoffier wrote:
> On 2015-02-28 16:30, Corinna Vinschen wrote:
> > 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))

No, this is wrong.  You're switching the code for icanon with the
code for -icanon.  -icanon in stty means ICANON is switched off.

I just gave it another try and the behaviour is perfectly valid.

The real problem is that "something" is setting VMIN to 4.  And that's
somehow inside the X server, if I'm not completely wrong:

- If you start an xterm from mintty like this:

    xterm -display :0

  and then call `stty -a' in it, you'll see that min is 1, and then
  script will behave as desired.

- However, if you start xterm from the X server tray icon and then
  call `stty -a' in it, min is set to 4 and script will misbehave.
  If you call `stty min 1' before calling script, script will work
  as expected again.

So, why does the X server (or whatever controls starting applications
from the X server tray icon) set VMIN to 4?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-24 19:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 19:06 [ANNOUNCEMENT] (last?) TEST RELEASE: Cygwin 1.7.35-0.5 Corinna Vinschen
2015-02-27 19:50 ` Habermann, David (D)
2015-02-28  0:06   ` Andrey Repin
2015-02-28  4:06 ` Denis Excoffier
2015-02-28 13:27   ` Corinna Vinschen
2015-02-28 20:26     ` Denis Excoffier
2015-02-28 21:32       ` Corinna Vinschen
2015-03-24 19:44         ` Under /bin/script, characters get printed in four-character chunks Denis Excoffier
2015-03-24 20:29           ` Corinna Vinschen [this message]
2015-03-25 16:05             ` X server sets VMIN? (was Re: Under /bin/script, characters get printed in four-character chunks) Denis Excoffier
2015-03-25 16:59               ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150324195339.GA32703@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).