Subject: bug#76343: shepherd 1.0.2 --help: warning: call to environ while multiple threads are running; further behavior unspecified.

From: Simon Josefsson <[email-masked]>
Date: Mon, 17 Feb 2025 00:33:14 +0100

Tomas Volf <[email-masked]> writes:

> Simon Josefsson via Bug reports for GNU Guix <[email-masked]> writes:
>
>> Hi
>>
>> It seems shepherd in Debian print the following on a simple --help:
>>
>> 132s warning: call to environ while multiple threads are running;
>> 132s          further behavior unspecified.
>>
>> I can't find the error message in guile-fibers or shepherd source code.
>> Any ideas where it comes from
>
> Guile itself, libguile/posix.c.
>
> libguile/posix.c
> 1724-  if (scm_ilength (scm_all_threads ()) != 1)
> 1725-    scm_display
> 1726-      (scm_from_latin1_string
> 1727:       ("warning: call to environ while multiple threads are running;\n"
> 1728-        "         further behavior unspecified.\n"),
> 1729-       scm_current_warning_port ());
> 1730-
>
>> and how to fix it?
>
> Do not call (environ) when multiple threads are running, but I assume
> that is not actually helpful advice. :)

Thank you for the pointer.  Interesting - why isn't this triggered on
Guix but only when building shepherd on a foreign distribution like
Debian?

Is the message really correct?  I thought guile-fibers and shepherd did
not use threads at all.

If it is possible to make --help and --version avoid launching new
threads, that would be nice to resolve this warning for at least the
simple use-case of doing --help and --version.

/Simon

>>
>> Version 1.0.0:
>> https://ci.debian.net/packages/s/shepherd/testing/amd64/57880388/
>>
>> Version 1.0.2:
>> https://salsa.debian.org/debian/shepherd/-/jobs/7101207#L718
>>
>> /Simon
>>