guix_mirror_bot pushed a commit to branch next-master
in repository guix.
commit 78bf4424f0744799d1b17ab1d9c8277b97580336
Author: Yelninei <[email protected]>
AuthorDate: Sun Dec 28 11:12:48 2025 +0000
gnu: hurd: Fix select for streamio.
* gnu/packages/patches/hurd-streamio-select.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/hurd.scm (hurd): Add patch.
Change-Id: I608380fbeab50ebc2e631488488aabf63e6483b4
Signed-off-by: Ludovic Courtès <[email protected]>
---
gnu/local.mk | 1 +
gnu/packages/hurd.scm | 1 +
gnu/packages/patches/hurd-streamio-select.patch | 88 +++++++++++++++++++++++++
3 files changed, 90 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 208dca9fff..f802c543ad 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1595,6 +1595,7 @@ dist_patch_DATA =
\
%D%/packages/patches/hurd-refcounts-assert.patch \
%D%/packages/patches/hurd-rumpdisk-no-hd.patch \
%D%/packages/patches/hurd-startup.patch \
+ %D%/packages/patches/hurd-streamio-select.patch \
%D%/packages/patches/hurd-proc-zombies.patch \
%D%/packages/patches/hwloc-1-test-btrfs.patch \
%D%/packages/patches/i3lock-blur-fix-build-on-gcc-10.patch \
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 5416a5588e..882236a39b 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -346,6 +346,7 @@ Hurd-minimal package which are needed for both glibc and
GCC.")
(patches (search-patches "hurd-refcounts-assert.patch"
"hurd-rumpdisk-no-hd.patch"
"hurd-startup.patch"
+ "hurd-streamio-select.patch"
"hurd-proc-zombies.patch"))))
(version (package-version hurd-headers))
(arguments
diff --git a/gnu/packages/patches/hurd-streamio-select.patch
b/gnu/packages/patches/hurd-streamio-select.patch
new file mode 100644
index 0000000000..4bd8e48a13
--- /dev/null
+++ b/gnu/packages/patches/hurd-streamio-select.patch
@@ -0,0 +1,88 @@
+Upstream status:
https://lists.gnu.org/archive/html/bug-hurd/2025-12/msg00043.html
+
+From ffe82c73f89d12393c62d5ba35b06552af40e029 Mon Sep 17 00:00:00 2001
+From: Yelninei <[email protected]>
+Date: Sun, 28 Dec 2025 10:59:56 +0000
+Subject: [PATCH 1/2] streamio (io_select_common): Don't return in case of
+ O_NONBLOCK.
+
+select should block even when opened with O_NONBLOCK.
+---
+ trans/streamio.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/trans/streamio.c b/trans/streamio.c
+index d21dc937..2a48d793 100644
+--- a/trans/streamio.c
++++ b/trans/streamio.c
+@@ -589,12 +589,6 @@ io_select_common (struct trivfs_protid *cred,
+ return 0;
+ }
+
+- if (cred->po->openmodes & O_NONBLOCK)
+- {
+- pthread_mutex_unlock (&global_lock);
+- return EWOULDBLOCK;
+- }
+-
+ ports_interrupt_self_on_port_death (cred, reply);
+ err = pthread_hurd_cond_timedwait_np (&select_alert, &global_lock, tsp);
+ if (err)
+--
+2.52.0
+
+From 090062ef555ffc29bcb7afcaad5bb46dad5973e9 Mon Sep 17 00:00:00 2001
+From: Yelninei <[email protected]>
+Date: Sun, 28 Dec 2025 11:03:57 +0000
+Subject: [PATCH 2/2] streamio (io_select_common): Request data if none is
+ available.
+
+If no data is available immediately start new read/write requests.
+---
+ trans/streamio.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/trans/streamio.c b/trans/streamio.c
+index 2a48d793..f7cd442f 100644
+--- a/trans/streamio.c
++++ b/trans/streamio.c
+@@ -190,6 +190,8 @@ error_t dev_write (const void *buf, size_t len, size_t
*amount, int nowait);
+ will wait for any activity to cease. */
+ error_t dev_sync (int wait);
+
++static error_t start_input (int nowait);
++static error_t start_output (int nowait);
+
+
+ static struct argp_option options[] =
+@@ -589,6 +591,27 @@ io_select_common (struct trivfs_protid *cred,
+ return 0;
+ }
+
++ if (*type & SELECT_READ)
++ {
++ err = start_input(1);
++ if (err)
++ {
++ *type = 0;
++ pthread_mutex_unlock (&global_lock);
++ return err;
++ }
++ }
++ if (*type & SELECT_WRITE)
++ {
++ err = start_output(1);
++ if (err)
++ {
++ *type = 0;
++ pthread_mutex_unlock (&global_lock);
++ return err;
++ }
++ }
++
+ ports_interrupt_self_on_port_death (cred, reply);
+ err = pthread_hurd_cond_timedwait_np (&select_alert, &global_lock, tsp);
+ if (err)
+--
+2.52.0
+