Skip to content

Commit 61e24ff

Browse files
authored
Merge pull request #194 from git-for-windows/msys2-runtime-cbe555e054cefeccd65250bb11dc56f82196301f
msys2-runtime: update to cbe555e054cefeccd65250bb11dc56f82196301f
2 parents 0219e7d + ba95e19 commit 61e24ff

File tree

3 files changed

+73
-6
lines changed

3 files changed

+73
-6
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From cbe555e054cefeccd65250bb11dc56f82196301f Mon Sep 17 00:00:00 2001
2+
From: Johannes Schindelin <[email protected]>
3+
Date: Thu, 10 Oct 2024 19:52:47 +0200
4+
Subject: [PATCH 52/N] Fix SSH hangs
5+
6+
It was reported in https://github.com/git-for-windows/git/issues/5199
7+
that as of v3.5.4, cloning or fetching via SSH is hanging indefinitely.
8+
9+
Bisecting the problem points to 555afcb2f3 (Cygwin: select: set pipe
10+
writable only if PIPE_BUF bytes left, 2024-08-18). That commit's
11+
intention seems to look at the write buffer, and only report the pipe as
12+
writable if there are more than one page (4kB) available.
13+
14+
However, the number that is looked up is the number of bytes that are
15+
already in the buffer, ready to be read, and further analysis
16+
shows that in the scenario described in the report, the number of
17+
available bytes is substantially below `PIPE_BUF`, but as long as they
18+
are not handled, there is apparently a dead-lock.
19+
20+
Since the old logic worked, and the new logic causes a dead-lock, let's
21+
essentially revert 555afcb2f3 (Cygwin: select: set pipe writable only if
22+
PIPE_BUF bytes left, 2024-08-18).
23+
24+
Note: This is not a straight revert, as the code in question has been
25+
modified subsequently, and trying to revert the original commit would
26+
cause merge conflicts. Therefore, the diff looks very different from the
27+
reverse diff of the commit whose logic is reverted.
28+
29+
Signed-off-by: Johannes Schindelin <[email protected]>
30+
---
31+
winsup/cygwin/select.cc | 6 +++---
32+
1 file changed, 3 insertions(+), 3 deletions(-)
33+
34+
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
35+
index bc02c3f..2c09b14 100644
36+
--- a/winsup/cygwin/select.cc
37+
+++ b/winsup/cygwin/select.cc
38+
@@ -776,7 +776,7 @@ out:
39+
}
40+
ssize_t n = pipe_data_available (s->fd, fh, h, PDA_SELECT | PDA_WRITE);
41+
select_printf ("write: %s, n %d", fh->get_name (), n);
42+
- gotone += s->write_ready = (n >= PIPE_BUF);
43+
+ gotone += s->write_ready = (n > 0);
44+
if (n < 0 && s->except_selected)
45+
gotone += s->except_ready = true;
46+
}
47+
@@ -990,7 +990,7 @@ out:
48+
ssize_t n = pipe_data_available (s->fd, fh, fh->get_handle (),
49+
PDA_SELECT | PDA_WRITE);
50+
select_printf ("write: %s, n %d", fh->get_name (), n);
51+
- gotone += s->write_ready = (n >= PIPE_BUF);
52+
+ gotone += s->write_ready = (n > 0);
53+
if (n < 0 && s->except_selected)
54+
gotone += s->except_ready = true;
55+
}
56+
@@ -1416,7 +1416,7 @@ out:
57+
{
58+
ssize_t n = pipe_data_available (s->fd, fh, h, PDA_SELECT | PDA_WRITE);
59+
select_printf ("write: %s, n %d", fh->get_name (), n);
60+
- gotone += s->write_ready = (n >= PIPE_BUF);
61+
+ gotone += s->write_ready = (n > 0);
62+
if (n < 0 && s->except_selected)
63+
gotone += s->except_ready = true;
64+
}

msys2-runtime/PKGBUILD

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pkgbase=msys2-runtime
55
pkgname=('msys2-runtime' 'msys2-runtime-devel')
66
pkgver=3.5.4
7-
pkgrel=1
7+
pkgrel=2
88
pkgdesc="Cygwin POSIX emulation engine"
99
arch=('x86_64')
1010
url="https://www.cygwin.com/"
@@ -77,9 +77,10 @@ source=('msys2-runtime'::git+https://github.com/cygwin/cygwin#tag=cygwin-${pkgve
7777
0048-msys2-runtime-restore-fast-path-for-current-user-pri.patch
7878
0049-Cygwin-console-Disable-cons_master_thread-in-win32-i.patch
7979
0050-Cygwin-pipe-Fix-a-regression-that-raw_write-slows-do.patch
80-
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch)
80+
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch
81+
0052-Fix-SSH-hangs.patch)
8182
sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
82-
'8540718a0c4812716949817852d914297ea214eabaa1de126f59ce77e8582e48'
83+
'46c8f9c0ed7259de78d5dc2edfd9479d873d21b64040fbca3b52045cb6e52c95'
8384
'9f9e1b6b05cbc9a715fe9443740b25171e9c1a276a058e6ba7e4f6eada6872c8'
8485
'e5b2095e543a5d702cfce6da26cd17a78f40e17620315b1bcc434b94a007ae9b'
8586
'f13b15dc14aa6ee1dd628a2487564bb484e74ff2f3e4059b9d9d64446a327db1'
@@ -130,7 +131,8 @@ sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
130131
'ccc574aee2f518ccb70aa65fa85e802d0b3da73c6833c1a8a3d07c91138135db'
131132
'5fb74f788388fcf23b2eab5e74be176c981f5cfcd9f01caf6a9e78cd8fc58e00'
132133
'394229cfa5293e4572dfd7155605343ca7426395429fa47eb38aced11d4f924b'
133-
'590dc0ce9e72a1adf1424c7a4f55bd57d8955eef036776895b3d779d4932d4ce')
134+
'590dc0ce9e72a1adf1424c7a4f55bd57d8955eef036776895b3d779d4932d4ce'
135+
'75e22e453011ea15c6cf6b6904c33256530d6f4ba273f03bc6a37d9245064c8c')
134136

135137
# Helper macros to help make tasks easier #
136138
apply_patch_with_msg() {
@@ -235,7 +237,8 @@ prepare() {
235237
0048-msys2-runtime-restore-fast-path-for-current-user-pri.patch \
236238
0049-Cygwin-console-Disable-cons_master_thread-in-win32-i.patch \
237239
0050-Cygwin-pipe-Fix-a-regression-that-raw_write-slows-do.patch \
238-
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch
240+
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch \
241+
0052-Fix-SSH-hangs.patch
239242
}
240243

241244
build() {

msys2-runtime/msys2-runtime.commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1e8cf1a59ae4e90396550cfe303ec13c0c5645ac
1+
cbe555e054cefeccd65250bb11dc56f82196301f

0 commit comments

Comments
 (0)