Subject: Re: bug#73181: guix-daemon fails when invoking‘guix authenticate’ on the Hurd

From: Ludovic Courtès <[email-masked]>
Date: Mon, 04 Nov 2024 09:21:17 +0100

Hello,

<[email-masked]> skribis:

> Ludovic Courtès writes:

[...]

>> That warning comes from libgc and there’s no such warning when LC_ALL is
>> left unset, which is why it works in that case.
>
> How about
>
>    0. Unsetting LC_ALL on the Hurd
>
> would that work?

I’m not sure, but if it does, it’s only “by chance”.

>> I see several possible things to do:
>>
>>   1. Disable GC warnings altogether in Guix by setting ‘GC_warn_proc’.
>>
>>   2. Make sure guix-daemon discards stderr from agents such as ‘guix
>>      authenticate’.
>>
>>   3. Figure out why those “Repeated allocation” messages are so frequent
>>      on i586-gnu and Do Something About It™.
>>
>> Thoughts?
>
> If 0., which seems easiest, does not work then Obviously(?) 3. is nicer
> but (much?) harder than 2., which is nicer than 1.  However, 1. is much
> nicer than our current situation of not having offloading to our
> childhurds and not having up-to-date substitutes.  How about doing
> 1. right now but only for the Hurd, until we get 2. or 3.?

Yeah, let’s start with (1), maybe with the patch below (untested)?

(2) and (3) would be nice, but it goes with increasing difficulty.

Ludo’.

diff --git a/gnu/packages/aux-files/guile-launcher.c b/gnu/packages/aux-files/guile-launcher.c
index ad0094bff5..6a59905a28 100644
--- a/gnu/packages/aux-files/guile-launcher.c
+++ b/gnu/packages/aux-files/guile-launcher.c
@@ -73,6 +73,15 @@ main (int argc, char **argv)
        which is always preferable over the C locale.  */
     setlocale (LC_ALL, "en_US.utf8");
 
+#if defined __GNU__
+  /* XXX: On 32-bit GNU/Hurd (i586-gnu), libgc emits "Repeated allocation"
+     warnings that are annoying and interfere with communications between
+     'guix-daemon' and 'guix authenticate':
+     <https://issues.guix.gnu.org/73181>.  Silence them.  */
+  static void no_warnings (char *message, GC_word arg) { };
+  GC_set_warn_proc (no_warnings);
+#endif
+
   const char *str;
   str = getenv ("GUILE_LOAD_PATH");
   load_path = str != NULL ? strdup (str) : NULL;