Skip to content

Conversation

dscho
Copy link
Member

@dscho dscho commented Jun 30, 2025

It was reported that a lengthy clone via SSH cannot be interrupted via Ctrl+C anymore.

This can be reproduced by cloning a large-ish repository via SSH, but even C:\cygwin64\bin\sleep 10 < NUL in a Windows Terminal will reproduce it.

I had reported this to the Cygwin developers and they fixed it, and in this PR here I cherry-pick the fix (cygwin/cygwin@61cc419b2b).

@dscho dscho self-assigned this Jun 30, 2025
@dscho dscho force-pushed the fix-ctrl+c-again branch from de81cc7 to 0e7838e Compare June 30, 2025 14:16
@dscho

This comment was marked as resolved.

Currently, ENABLE_PROCESSED_INPUT is set in set_input_mode() if
master_thread_suspended is true. This enables Ctrl-C handling when
cons_master_thread is suspended, since Ctrl-C is normally handled
by cons_master_thread.
However, when disable_master_thread is true, ENABLE_PROCESSED_INPUT
is not set, even though this also disables Ctrl-C handling in
cons_master_thread. Due to this bug, the command
  C:\cygwin64\bin\sleep 10 < NUL
in the Command Prompt cannot be terminated with Ctrl-C.

This patch addresses the issue by setting ENABLE_PROCESSED_INPUT
when either disable_master_thread or master_thread_suspended is true.

This bug also affects cases where non-Cygwin Git (Git for Windows)
launches Cygwin SSH. In such cases, SSH also cannot be terminated
with Ctrl-C.

Addresses: git-for-windows/git#5682 (comment)
Fixes: 746c811 ("Cygwin: console: Allow pasting very long text input.")
Reported-by: Johannes Schindelin <[email protected]>
Signed-off-by: Takashi Yano <[email protected]>
(cherry picked from commit 476135a24506dd624eb46b50fd634fcd740008ba)
Cherry-picked-from: 61cc419 (Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread, 2025-07-01))
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the fix-ctrl+c-again branch from 0e7838e to 7674c51 Compare July 1, 2025 08:47
@dscho dscho marked this pull request as ready for review July 1, 2025 08:50
@dscho
Copy link
Member Author

dscho commented Jul 1, 2025

/open pr

The workflow run was started

@dscho

This comment was marked as outdated.

github-actions bot pushed a commit to git-for-windows/build-extra that referenced this pull request Jul 1, 2025
In Git for Windows v2.50.0, operations using the POSIX emulation layer
(cloning via SSH, generating the Bash prompt) cannot be interrupted by
Ctrl+C, which [has been
fixed](git-for-windows/msys2-runtime#104).

Signed-off-by: gitforwindowshelper[bot] <[email protected]>
@dscho dscho merged commit 696ac94 into git-for-windows:main Jul 1, 2025
31 checks passed
@dscho dscho deleted the fix-ctrl+c-again branch July 1, 2025 09:50
MarkEWaite added a commit to MarkEWaite/docker-lfs that referenced this pull request Jul 2, 2025
* Cloning: large repositories via SSH frequently hung with Git for
  Windows v2.50.0 git-for-windows/git#5688
  fixed in git-for-windows/msys2-runtime#103

* In: Git for Windows v2.50.0, operations using the POSIX emulation
  layer (cloning via SSH, generating the Bash prompt) cannot be
  interrupted by Ctrl+C, fixed in
  git-for-windows/msys2-runtime#104

* Git: for Windows v2.50.0 is unable to initialize Git repositories on
  Windows Server 2016
  git-for-windows/git#5695), fixed in
  git-for-windows/git#5700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants