public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: X server sets VMIN? (was Re: Under /bin/script, characters get printed in four-character chunks)
Date: Wed, 25 Mar 2015 16:59:00 -0000	[thread overview]
Message-ID: <20150325160504.GE3017@calimero.vinschen.de> (raw)
In-Reply-To: <641C04A3-5059-48A5-830D-4B095935366B@Denis-Excoffier.org>

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

On Mar 25 16:26, Denis Excoffier wrote:
> On 2015-03-24 20:53, Corinna Vinschen wrote:
> > - 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?
> > 
> 
> It seems that this has something to do with tcsh (and not with XWin).
> If you arrange your environment in order that the xterm launches /bin/bash
> (instead of tcsh), you get min=0 under 'stty -a' and /bin/script behaves
> as expected. If afterwards, in such an xterm, you run '/bin/csh -f', you get
> min=4.
> 
> Consider the following:
> 
> diff -uNr tcsh-6.18.01-original/ed.init.c tcsh-6.18.01-patched/ed.init.c
> --- tcsh-6.18.01-original/ed.init.c	2006-08-24 22:56:08.000000000 +0200
> +++ tcsh-6.18.01-patched/ed.init.c	2015-03-25 15:56:33.000000000 +0100
> @@ -65,7 +65,7 @@
>  	(uc)CDSWTCH,	(uc)CERASE2,	 (uc)CSTART, 	   (uc)CSTOP,
>  	(uc)CWERASE, 	(uc)CSUSP, 	 (uc)CDSUSP, 	   (uc)CREPRINT,
>  	(uc)CDISCARD, 	(uc)CLNEXT,	 (uc)CSTATUS,	   (uc)CPAGE,
> -	(uc)CPGOFF,	(uc)CKILL2, 	 (uc)CBRK, 	   (uc)CMIN,
> +	(uc)CPGOFF,	(uc)CKILL2, 	 (uc)CBRK, 	   (uc)1,
>  	(uc)CTIME
>      },
>      {
> 
> In the original code, CMIN is set to CEOF and CEOF is set to Control-D, hence
> min=4. With the patch above, all seems to go well. But this does not
> explain why the min=4 is not permanent.

Thanks for looking into that.  I'm not sure either why this doesn't
occur all the time, but the culprit seems to be this snippet in
ed.term.h:

  #ifndef CMIN
  # define CMIN          CEOF
  #endif /* CMIN */

The default value for CEOF is '\4'.  And no header on Cygwin defines
CMIN, so this looks like two bugs in one (buy one, get one free).

Per `git blame' this code in tcsh is from 1991, so maybe we have two
20th century bugs here.

I'll ask the tcsh maintainer and add a definition for CMIN to 1 (as on
Linux) to the headers for the next Cygwin version.


Thanks,
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-25 16:05 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           ` X server sets VMIN? (was Re: Under /bin/script, characters get printed in four-character chunks) Corinna Vinschen
2015-03-25 16:05             ` Denis Excoffier
2015-03-25 16:59               ` Corinna Vinschen [this message]

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=20150325160504.GE3017@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).