public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Cygwin doesn't handle SIGWINCH properly in Windows Terminal
Date: Tue, 16 Feb 2021 15:11:56 -0700	[thread overview]
Message-ID: <cb471098-8052-32aa-6943-1cb115b67059@SystematicSw.ab.ca> (raw)
In-Reply-To: <d2ef5af4-e976-dd25-39b3-b8acdc118922@towo.net>

On 2021-02-16 13:50, Thomas Wolff wrote:
> Am 16.02.2021 um 21:37 schrieb Takashi Yano via Cygwin:
>> On Tue, 16 Feb 2021 09:26:52 -0700
>> Brian Inglis wrote:
>>> On 2021-02-16 04:31, Takashi Yano via Cygwin wrote:
>>>> On Tue, 16 Feb 2021 19:31:54 +0900
>>>> Takashi Yano wrote:
>>>>> On Sun, 14 Feb 2021 17:43:58 +0900
>>>>> Takashi Yano wrote:
>>>>>> On Sat, 13 Feb 2021 20:39:39 +1000
>>>>>> Alvin Seville wrote:
>>>>>>> Windows build number: Win32NT 10.0.19042.0 Microsoft Windows NT 10.0.19042.0
>>>>>>> Windows Terminal version (if applicable): 1.5.10271.0
>>>>>>> Script to reproduce this issue:
>>>>>>> #!/usr/bin/env bashfunction outputText()
>>>>>>> {
>>>>>>>     local text=$1
>>>>>>>     local -i textLength=${#text}
>>>>>>>
>>>>>>>     local -i line="$(tput lines) / 2"
>>>>>>>     local -i col="$(tput cols) / 2 - $textLength / 2"
>>>>>>>
>>>>>>>     clear
>>>>>>>     echo -en "\e[$line;${col}H$text"
>>>>>>> }
>>>>>>> trap "outputText 'Hello world!'" SIGWINCH
>>>>>>> outputText 'Hello world!'while truedo
>>>>>>>       :done
>>>>>> This is because cygwin console handles SIGWINCH when the input
>>>>>> messages is processed. If the process does not call either read()
>>>>>> or select(), SIGWINCH will not be sent. This is the long standing
>>>>>> problem of the implementation and hard to fix.
>>>>> I came up with a solution for this issue and implemented that.
>>>>> It seems working as expected as far as I tested while I did not
>>>>> have to change the code much contrary to my concern.
>>>>>
>>>>> The point of the idea is to keep the basic structure of the
>>>>> console code unchanged and introduce a new thread which handle
>>>>> the only signals derived from input records. Handling of Ctrl-S
>>>>> and Ctrl-Q also added.
>>>>>
>>>>> I would like to submit the patch to cygwin-patches mailing list.
>>>>>
>>>>> Corinna, could you please have a look?
>>>> v2: Problems when input echo is stopped by Ctrl-S is fixed.
>>> Do these changes (still?) honour stty flags like isig, ixany, noflsh and handle
>>> interrupt character settings for e.g.:
>>>     intr = ^C; quit = ^\; swtch = ^Z; start = ^Q; stop = ^S; susp = ^Z;
>>>     discard = ^O;
>>> ?
>> Basically yes. However, stty noflsh, flusho and Ctrl-O
>> does not take effect in the current code with/without
>> the patch.
> Output flushing doesn't work in the pty either, and neither in Linux. The 
> setting seems to be a relic from Unix systems.

It was an interactive shortcut to send excessive output to the bit bucket 
*after* a command was run, which saved dialup I/O charges, and time, when dialup 
was slow and expensive, and terminals were slow TTYs.
It's still useful if you finger fumble and get too many unexpected hits on a 
recursive find or grep.

Predates Unix by a decade - was standard on all DEC(/Digital) OSes and their 
offshoots like Tenex and Unix, the function was available in Multics tty DIM 
(whatever that stood for) - can't find any details by searching (many scanned 
docs predate useful OCR and are hundreds of pages) - may have come from MIT CTSS 
(which had many of the features and functions of Unix), the development system 
for Project MAC (the development project with many spinoffs, one of those 
Multics, another the CTSS and Multics AI Lab competitor ITS), or the 
predecessors on which they were based.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

      reply	other threads:[~2021-02-16 22:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13 10:39 Alvin Seville
2021-02-13 17:38 ` Brian Inglis
2021-02-14  8:43 ` Takashi Yano
2021-02-14 20:44   ` L A Walsh
2021-02-15  0:05     ` Takashi Yano
2021-02-16  2:17       ` L A Walsh
2021-02-16  5:48         ` Marco Atzeri
2021-02-16  6:20           ` Brian Inglis
2021-02-16 10:26             ` Thomas Wolff
2021-02-16 10:38               ` Thomas Wolff
2021-02-16 21:55               ` L A Walsh
2021-02-15  0:21     ` Takashi Yano
2021-02-16 10:31   ` Takashi Yano
2021-02-16 11:31     ` Takashi Yano
2021-02-16 16:26       ` Brian Inglis
2021-02-16 20:37         ` Takashi Yano
2021-02-16 20:50           ` Thomas Wolff
2021-02-16 22:11             ` Brian Inglis [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=cb471098-8052-32aa-6943-1cb115b67059@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --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).