Skip to content

Commit

Permalink
msys2-runtime: update to cbe555e054cefeccd65250bb11dc56f82196301f
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Oct 10, 2024
1 parent 0219e7d commit ba95e19
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 6 deletions.
64 changes: 64 additions & 0 deletions msys2-runtime/0052-Fix-SSH-hangs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From cbe555e054cefeccd65250bb11dc56f82196301f Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Thu, 10 Oct 2024 19:52:47 +0200
Subject: [PATCH 52/N] Fix SSH hangs

It was reported in https://github.com/git-for-windows/git/issues/5199
that as of v3.5.4, cloning or fetching via SSH is hanging indefinitely.

Bisecting the problem points to 555afcb2f3 (Cygwin: select: set pipe
writable only if PIPE_BUF bytes left, 2024-08-18). That commit's
intention seems to look at the write buffer, and only report the pipe as
writable if there are more than one page (4kB) available.

However, the number that is looked up is the number of bytes that are
already in the buffer, ready to be read, and further analysis
shows that in the scenario described in the report, the number of
available bytes is substantially below `PIPE_BUF`, but as long as they
are not handled, there is apparently a dead-lock.

Since the old logic worked, and the new logic causes a dead-lock, let's
essentially revert 555afcb2f3 (Cygwin: select: set pipe writable only if
PIPE_BUF bytes left, 2024-08-18).

Note: This is not a straight revert, as the code in question has been
modified subsequently, and trying to revert the original commit would
cause merge conflicts. Therefore, the diff looks very different from the
reverse diff of the commit whose logic is reverted.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/select.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index bc02c3f..2c09b14 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -776,7 +776,7 @@ out:
}
ssize_t n = pipe_data_available (s->fd, fh, h, PDA_SELECT | PDA_WRITE);
select_printf ("write: %s, n %d", fh->get_name (), n);
- gotone += s->write_ready = (n >= PIPE_BUF);
+ gotone += s->write_ready = (n > 0);
if (n < 0 && s->except_selected)
gotone += s->except_ready = true;
}
@@ -990,7 +990,7 @@ out:
ssize_t n = pipe_data_available (s->fd, fh, fh->get_handle (),
PDA_SELECT | PDA_WRITE);
select_printf ("write: %s, n %d", fh->get_name (), n);
- gotone += s->write_ready = (n >= PIPE_BUF);
+ gotone += s->write_ready = (n > 0);
if (n < 0 && s->except_selected)
gotone += s->except_ready = true;
}
@@ -1416,7 +1416,7 @@ out:
{
ssize_t n = pipe_data_available (s->fd, fh, h, PDA_SELECT | PDA_WRITE);
select_printf ("write: %s, n %d", fh->get_name (), n);
- gotone += s->write_ready = (n >= PIPE_BUF);
+ gotone += s->write_ready = (n > 0);
if (n < 0 && s->except_selected)
gotone += s->except_ready = true;
}
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=1
pkgrel=2
pkgdesc="Cygwin POSIX emulation engine"
arch=('x86_64')
url="https://www.cygwin.com/"
Expand Down Expand Up @@ -77,9 +77,10 @@ source=('msys2-runtime'::git+https://github.com/cygwin/cygwin#tag=cygwin-${pkgve
0048-msys2-runtime-restore-fast-path-for-current-user-pri.patch
0049-Cygwin-console-Disable-cons_master_thread-in-win32-i.patch
0050-Cygwin-pipe-Fix-a-regression-that-raw_write-slows-do.patch
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch)
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch
0052-Fix-SSH-hangs.patch)
sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
'8540718a0c4812716949817852d914297ea214eabaa1de126f59ce77e8582e48'
'46c8f9c0ed7259de78d5dc2edfd9479d873d21b64040fbca3b52045cb6e52c95'
'9f9e1b6b05cbc9a715fe9443740b25171e9c1a276a058e6ba7e4f6eada6872c8'
'e5b2095e543a5d702cfce6da26cd17a78f40e17620315b1bcc434b94a007ae9b'
'f13b15dc14aa6ee1dd628a2487564bb484e74ff2f3e4059b9d9d64446a327db1'
Expand Down Expand Up @@ -130,7 +131,8 @@ sha256sums=('3812485e2a6ab8360e5b9d566a47b982852ff2b140cea4e332ded19c11c77663'
'ccc574aee2f518ccb70aa65fa85e802d0b3da73c6833c1a8a3d07c91138135db'
'5fb74f788388fcf23b2eab5e74be176c981f5cfcd9f01caf6a9e78cd8fc58e00'
'394229cfa5293e4572dfd7155605343ca7426395429fa47eb38aced11d4f924b'
'590dc0ce9e72a1adf1424c7a4f55bd57d8955eef036776895b3d779d4932d4ce')
'590dc0ce9e72a1adf1424c7a4f55bd57d8955eef036776895b3d779d4932d4ce'
'75e22e453011ea15c6cf6b6904c33256530d6f4ba273f03bc6a37d9245064c8c')

# Helper macros to help make tasks easier #
apply_patch_with_msg() {
Expand Down Expand Up @@ -235,7 +237,8 @@ prepare() {
0048-msys2-runtime-restore-fast-path-for-current-user-pri.patch \
0049-Cygwin-console-Disable-cons_master_thread-in-win32-i.patch \
0050-Cygwin-pipe-Fix-a-regression-that-raw_write-slows-do.patch \
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch
0051-Cygwin-pipe-Restore-blocking-mode-of-read-pipe-on-cl.patch \
0052-Fix-SSH-hangs.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 @@
1e8cf1a59ae4e90396550cfe303ec13c0c5645ac
cbe555e054cefeccd65250bb11dc56f82196301f

0 comments on commit ba95e19

Please sign in to comment.