Skip to content

Commit

Permalink
Merge pull request #201 from git-for-windows/msys2-runtime-395fda678b…
Browse files Browse the repository at this point in the history
…4448587cabbeab936318459c10f209

msys2-runtime: update to 395fda678b4448587cabbeab936318459c10f209
  • Loading branch information
dscho authored Nov 25, 2024
2 parents b5e2da3 + 22de9ac commit 1e0586b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
From 395fda678b4448587cabbeab936318459c10f209 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Thu, 21 Nov 2024 22:13:42 -0800
Subject: [PATCH 56/N] Cygwin: revert use of CancelSyncronousIo on
wait_thread.

It appears this is causing hangs on native x86_64 in similar scenarios
as the hangs on ARM64, because `CancelSynchronousIo` is returning `TRUE`
but not canceling the `ReadFile` call as expected.

Cherry-picked from msys2/msys2-runtime's 2eb6be14ee (Cygwin: revert use
of CancelSyncronousIo on wait_thread., 2024-11-21).

Addresses: https://github.com/msys2/MSYS2-packages/issues/4340#issuecomment-2491401847
Fixes: b091b47b9e56 ("cygthread: suspend thread before terminating.")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/pinfo.cc | 7 +++----
winsup/cygwin/sigproc.cc | 3 +--
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 43e0034..a5f5d6e 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -1262,14 +1262,13 @@ proc_waiter (void *arg)

for (;;)
{
- DWORD nb, err;
+ DWORD nb;
char buf = '\0';

if (!ReadFile (vchild.rd_proc_pipe, &buf, 1, &nb, NULL)
- && (err = GetLastError ()) != ERROR_BROKEN_PIPE)
+ && GetLastError () != ERROR_BROKEN_PIPE)
{
- if (err != ERROR_OPERATION_ABORTED)
- system_printf ("error on read of child wait pipe %p, %E", vchild.rd_proc_pipe);
+ system_printf ("error on read of child wait pipe %p, %E", vchild.rd_proc_pipe);
break;
}

diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index d180277..5c5ff73 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -410,8 +410,7 @@ proc_terminate ()
if (!have_execed || !have_execed_cygwin)
chld_procs[i]->ppid = 1;
if (chld_procs[i].wait_thread)
- if (!CancelSynchronousIo (chld_procs[i].wait_thread->thread_handle ()))
- chld_procs[i].wait_thread->terminate_thread ();
+ chld_procs[i].wait_thread->terminate_thread ();
/* Release memory associated with this process unless it is 'myself'.
'myself' is only in the chld_procs table when we've execed. We
reach here when the next process has finished initializing but we
13 changes: 8 additions & 5 deletions msys2-runtime/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pkgbase=msys2-runtime
pkgname=('msys2-runtime' 'msys2-runtime-devel')
pkgver=3.5.4
pkgrel=4
pkgrel=5
pkgdesc="Cygwin POSIX emulation engine"
arch=('x86_64')
url="https://www.cygwin.com/"
Expand Down Expand Up @@ -81,9 +81,10 @@ source=('msys2-runtime'::git+https://github.com/cygwin/cygwin#tag=cygwin-${pkgve
0052-Fix-SSH-hangs.patch
0053-Cygwin-find_fast_cwd-don-t-run-assembler-checking-co.patch
0054-cygthread-suspend-thread-before-terminating.patch
0055-fixup-cygthread-suspend-thread-before-terminating.patch)
0055-fixup-cygthread-suspend-thread-before-terminating.patch
0056-Cygwin-revert-use-of-CancelSyncronousIo-on-wait_thre.patch)
sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
'd6b70c10a740be79a95afdb65c4f557f8f4aaaf24e67010f6efe6ff5c21ed5db'
'827a95d14b6a6c5ec2875c571a38b82d136a845d89e44d7b895c71a9ac4b3be2'
'9f9e1b6b05cbc9a715fe9443740b25171e9c1a276a058e6ba7e4f6eada6872c8'
'e5b2095e543a5d702cfce6da26cd17a78f40e17620315b1bcc434b94a007ae9b'
'f13b15dc14aa6ee1dd628a2487564bb484e74ff2f3e4059b9d9d64446a327db1'
Expand Down Expand Up @@ -138,7 +139,8 @@ sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
'75e22e453011ea15c6cf6b6904c33256530d6f4ba273f03bc6a37d9245064c8c'
'7fe562197a1f3b67b1e794808186c10ff0186b0fcf8d09a8021499b952d04d2c'
'957ea63fbe8e950276dd9deaf9ad3d52bb1558cc6ae71dd741ed3bf14d882499'
'0234fe3a4903fcff8c17a5eff680c357582028f5f794da4e9da68fe843a95ecb')
'0234fe3a4903fcff8c17a5eff680c357582028f5f794da4e9da68fe843a95ecb'
'da3e715e6789295d49afb6ef778f03591b710b4b579c3849674898d159f349bd')

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
Expand Down Expand Up @@ -247,7 +249,8 @@ prepare() {
0052-Fix-SSH-hangs.patch \
0053-Cygwin-find_fast_cwd-don-t-run-assembler-checking-co.patch \
0054-cygthread-suspend-thread-before-terminating.patch \
0055-fixup-cygthread-suspend-thread-before-terminating.patch
0055-fixup-cygthread-suspend-thread-before-terminating.patch \
0056-Cygwin-revert-use-of-CancelSyncronousIo-on-wait_thre.patch
}

build() {
Expand Down
2 changes: 1 addition & 1 deletion msys2-runtime/msys2-runtime.commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
54a725237845135bbb4609e1194366dece79a0e3
395fda678b4448587cabbeab936318459c10f209

0 comments on commit 1e0586b

Please sign in to comment.