Subject: [bug#77943] [PATCH 1/2] services: shepherd: Provide the right #:kernel-log-file on the Hurd.

From: [email-masked]
Date: Tue, 10 Jun 2025 11:50:27 +0200 (CEST)

Hello Ludo,

Jun 2, 2025, 16:09 by [email-masked]:

> Hi,
>
> Right, I started looking into it back then but then didn’t take the time
> to track it down.
>

I tried your patch that you sent to bug-hurd but I still end up with D_WOULD_BLOCK at the end. Was it working for you?

As pointed out by Samuel on bug-hurd the initial "if (err) return err" looks weird. I tried removing it and at the end of /dev/klog it died with SIGLOST.

I then tried this patch similar to yours to intercept D_WOULD_BLOCK at the beginning instead:

diff --git a/trans/streamio.c b/trans/streamio.c
index e42ff908..ee3cf9b4 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -1005,7 +1005,12 @@ dev_read (size_t amount, void **buf, size_t *len, int nowait)
   size_t max, avail;
 
   if (err)
-    return err;
+    {
+      if (err == D_WOULD_BLOCK)
+	  return EWOULDBLOCK;
+      else
+	  return err;
+    }
 
   while (!buffer_readable (input_buffer))
     {

and my example now fails with EAGAIN.

I am not sure yet what is setting this, the joy of global variables.

However something still seems wrong when I added back the shepherd syslog. It still crashes/hangs when it reaches the initial end of /dev/klog and does not process messages further: 
there is an extra message and e.g. sshd messages to the syslog dont get processed.

root@childhurd ~# ./main
irq handler [11]: new delivery port f5e44038 entry f4f39840

errno: Resource temporarily unavailable

To be continued.

Note: I had to add the patch to the default hurd and just patching the hurd package that is used in operating-system-hurd was not enough. Dont know what is up with that.

> Thanks,
> Ludo’.