DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 565GI6H62410613
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 565GI6H62410613
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=OmaktPjJ
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F1A43852102
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1751732284;
	bh=e1HZKBFDQa6iPkZhKsOrsxH4XwywA5jY41/B0D6DuSg=;
	h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=OmaktPjJChaP/ZyAM/LNGVPcxY2OrPinr74s/JRqLMHc6PXLVevohphRxFWkU0Lcj
	 NTjNiuCTJnfn4dUwxn77BJyZBENhpeo85DF9OCX18n2c746eZVJud48F7GETGE+9mE
	 wf99OesUCA2v+fobmz2pJwkickhOLZmwz8cVFSZU=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9ECBD385C6DD
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9ECBD385C6DD
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1751732259; cv=none;
 b=pBnM14yN8RU8NdYs6IbkHpzS8hwmmIG+Sijur3rQ7zoJiHDHSCNhxd9eu5vpuxtMhJSTvh8qRwEJY5NFTUIe81WfstYMOy+ybdgYUtvSMN+aVKJsB2tV8wwLda5wxWIiOAC1Vx/Xc77Rt76nrHJL7D60lmvCPfV5OYbKGCL43uU=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1751732259; c=relaxed/simple;
 bh=Hge05nt+1iRzgCorFscd8d+Tgkyo7QvlITzHQK1QZ4o=;
 h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;
 b=gOSofTOU4zgyst9UlWqAaDlvDIRblqNhaXmototu6HhN6WoPExwr7DoAOSEvV0IOGMzFxzUDPDGEqA9G2iLBBkuTREDmReDFSfd8ewCiDfwSPfsgYvDs9aLTpmSW1wbGWCpW7Qp8Xo/wZY6lRuITGYlN0ke74gtHBQ5B+kvSlL0=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ECBD385C6DD
X-Virus-Scanned: by MailRoute
Message-ID: <ffa582e2-601f-44b4-86c8-3bfb5d562a9c@acm.org>
Date: Sat, 5 Jul 2025 09:17:34 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: mintty-bash-ssh weirdness after remote disconnect during vi
 session
Content-Language: en-US
To: cygwin@cygwin.com
References: <3ba4421c-2653-48e7-878f-0d91218ab81e@acm.org>
 <d9ba6af2-39a9-40c7-8ac6-58a5be3b9cb2@towo.net>
Autocrypt: addr=jhg@acm.org; keydata=
 xsDiBDWEWocRBADfF9Q6lhkW9USReZ96cBC93kq3bblkNslVAZzm9itW7sAEzHbydIZ9hZjm
 e93UxUPzg1zGXX9xrdQy0+lHxkj2wvzgEF50Kqjft6KAd8AqiNmcbu5Q+/SHIP87C/tD/wWO
 TX7I99ekggy+5a6illN/s7MhuPIsMtt3ofFFcuOvswCg/08V11KALulG6u9j1affyHy20UMD
 /A1MRT3YZt6NJE9XbcalVLQzWc+ArCkW0oxNs/wrQ26lYoWuj20nusq9MDkuOL1h1FxeUrgx
 kKP+1zyYaQkB2lbJyvGvIpXgxY4vUnOXwMovTcRST3bWOOSIiYVOzKWJh5fPtoEaU5wFZ6yU
 lu/QGoS8Lt9QOI/XjjRaJjf0T6rKBADTn4xcxNIQNWSxJthmH3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BzjYi0zgCgv6RuSo28x1TBIbEQJgAwAV6D
 PdMAnjC3YrzFCHHmI+4tNkU/JmgLy+t3
In-Reply-To: <d9ba6af2-39a9-40c7-8ac6-58a5be3b9cb2@towo.net>
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Jim Garrison via Cygwin <cygwin@cygwin.com>
Reply-To: Jim Garrison <jhg@acm.org>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 565GI6H62410613

On 7/4/2025 18:49, Thomas Wolff via Cygwin wrote:
> 
> Am 05.07.2025 um 03:04 schrieb Jim Garrison via Cygwin:
>> I've recently started seeing weirdness in mintty/bash after a 
>> connection to a remote system is terminated by the remote.  So far 
>> this seems to happen only if the remote session was interrupted while 
>> vi was running.
>>
>> After the session is interrupted, here's what happens on the local 
>> (Windows/cygwin) mintty window:
>>
>> * Ctrl-D just rings the tty "bell"
>>
>> * Any change of window focus, in Windows, for the mintty window itself,
>>   causes the tty bell to ring
>>
>> I researched this by opening a second terminal session and using that 
>> to kill various processes in the remote tree: ssh-bash-vi and found 
>> that just killing the vi process causes the issue.  On the remote 
>> system, Ctrl-D produces the string "0;5u".  Exiting the remote session 
>> (via 'exit') then leaves the local mintty in the same state.
>>
>> I guess it's because vi remaps keystrokes and they didn't get reset 
>> when vi died, but my usual goto 'stty sane' does not fix the problem, 
>> neither on the remote nor local systems.
> Certainly a good guess. You can check your state with `stty -a`, for 
> example about ^D behaviour.
> 
>> Is there a way to reset mintty other than closing and reopening it?
> Try the `reset` command. Or the `Reset` function from the context menu, 
> also via Alt+F8.

`reset` does the trick.  However my curiosity is piqued since it appears 
the remote vi somehow remapped a lot of keystrokes in the local mintty. 
In fact, it seems to have mapped ALL the uppercase letters to escape 
sequences... but left all the lowercase letters, numbers and puctuation 
alone.

Interesting, but probably not worth spending any time on. It's just part 
of the "undefined but not really unexpected" behavior when you pull the 
rug out from under a program that remaps terminal keystrokes for its own 
use :-)

-- 
Jim Garrison
jhg@acm.org

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

