Conversation
Currently, when cygwin app is launched, the console input mode is
set to tty::cygwin, even if the stdin is not a console. However,
it is not necessary because the cygwin app does not use stdin.
This also applies to stdout and stderr.
With this patch, the console mode is set only when std{in,out,err}
is a console for the cygwin app for better coexistence with non-
cygwin apps.
This is a prerequisite for the experimental backport of Takashi Yano's
v15 console-mode patch to msys2-3.6.10. The release branch's later,
already-applied suspension-before-mode ordering is preserved.
(cherry picked from commit bbd3710)
Assisted-by: GPT-6
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Previously, if two non-cygwin apps are started and one of them exits first, the other one loosed appropriate console mode, since the first one restored it to tty::cygwin. This patch counts the active console process whose pgid is pgid of the tty and if the result is zero (means the last non-cygwin foreground process), restore console mode. To avoid race issue between apps modifying console mode simultaneously, this patch also introduce a mutex named `cons_mode_mutex`. Known limitation: In the case of non-overlayed spawn, there still exists a small window in which another non-cygwin process may restore tty::cygwin mode even though new non-cygwin app is about to start. This is an experimental backport of Takashi Yano's v15 console-mode patch to msys2-3.6.10. Its prerequisite, bbd3710, is included in full by the preceding commit. Upstream review is ongoing. Message-ID: 20260913060128.1453-1-takashi.yano@nifty.ne.jp Fixes: 48285aa ("Cygwin: console: Fix handling of Ctrl-S in Win7.") Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Assisted-by: GPT-6 Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
…in apps Avoid the cleanup/startup deadlock: cleanup can hold `cons_mode_mutex` while waiting for a console master that a new owner cannot start until acquiring that mutex. Startup must precede the mode-mutex wait without changing the handshake or mode serialization. Also avoid waiting forever for an owner that exited without clearing ownership. A confirmed exit permits ending the wait only while the captured owner is still recorded, excluding the -1 normal-retirement sentinel. Preserve the published request for a replacement worker; a missing worker is not an acknowledgement. Assisted-by: GPT-6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This was referenced Sep 15, 2026
Collaborator
Author
|
Superseded by #366 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is not expected to be the final version of this patch.
This is an experimental backport of Takashi Yano's v15 patch to
msys2-3.6.10for investigating console-mode and cleanup hangs involving concurrent native processes.The preceding commit backports the prerequisite console-mode guards, including the companion standard-handle lifetime change in
dtable.cc. This preserves the assumptions behind v15 instead of retaining the release branch's older unconditional mode changes.Upstream review remains ongoing. This is not a claim that msys2/MSYS2-packages#6445 is resolved.