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

Previous Next

Package: guix;

Reported by: Simon Josefsson <simon <at> josefsson.org>

Date: Sun, 16 Feb 2025 17:31:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Josefsson <simon <at> josefsson.org>
Cc: 76343 <at> debbugs.gnu.org
Subject: bug#76343: shepherd 1.0.2 --help: warning: call to environ while multiple threads are running; further behavior unspecified.
Date: Tue, 04 Mar 2025 16:39:46 +0100
[Message part 1 (text/plain, inline)]
Hi,

Simon Josefsson <simon <at> josefsson.org> skribis:

> A shephard-specific patch would be the simplest at this point, I think.
>  
> Do you have some idea how to do that?  I agree it seems like a Debian-
> specific patch for now.

The patch below appears to do the trick.  I guess I could just as well
integrate it in the next 1.0.x bug-release.

Does it work for you?

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index d55373a..a35a415 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -515,7 +515,11 @@ fork in the child process."
                          ;; stdout.  Redirect stdout to the bitbucket so we
                          ;; don't log twice.
                          (%make-void-port "w")
-                         (current-output-port)))))
+                         (current-output-port))))
+
+                   ;; In Guile 3.0.10, calling 'environ' from the top-level
+                   ;; triggers a warning so do it from here.
+                   (default-environment-variables (environ)))
 
       (parameterize ((current-output-port (%current-service-output-port)))
         (set-port-encoding! (log-output-port) "UTF-8")
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 2d64897..c8667e6 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1437,7 +1437,7 @@ background:~{ ~a~}."
 (define default-environment-variables
   ;; The default list of environment variable name/value pairs that should be
   ;; set when starting a service.
-  (make-parameter (environ)))
+  (make-parameter '()))
 
 (define default-pid-file-timeout
   ;; Maximum number of seconds to wait for a PID file to show up.

This bug report was last modified 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.