GNU bug report logs - #77220
[shepherd]: Timers do not set HOME environment variable correctly

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Tomas Volf <~@wolfsden.cz>; Done: Tomas Volf <~@wolfsden.cz>; Maintainer for guix is bug-guix@HIDDEN.

Message received at 77220 <at> debbugs.gnu.org:


Received: (at 77220) by debbugs.gnu.org; 3 Apr 2025 11:27:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 03 07:27:30 2025
Received: from localhost ([127.0.0.1]:33047 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u0IjD-0006yy-FW
	for submit <at> debbugs.gnu.org; Thu, 03 Apr 2025 07:27:30 -0400
Received: from wolfsden.cz ([37.205.8.62]:59536)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1u0IjA-0006yp-BL
 for 77220 <at> debbugs.gnu.org; Thu, 03 Apr 2025 07:27:21 -0400
Received: by wolfsden.cz (Postfix, from userid 104)
 id A985F298021; Thu,  3 Apr 2025 11:27:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743679638; bh=tpb5I4x09tfKNj0XJq4fIRifj0gQ7+wcBt74FMo138A=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=jYhnbJL8InBUT1Ao+GBT/ay8zyO8IQUrZTTjDFEtmv2d9RKPa/mAc/ktOpOdFRevc
 69cfMhO3gfMMipjqSezRZOUifMZ37yqPSWudYUufYGTRawFq9z/0Nnhcd9DJFRru3T
 eA0col92I0Uxffd0XgWrjBDKyTiEmXLYoj2OVTtltXTEXcytiFMXbtkO7ZI9aL/OPk
 t9dU7ri9Vt/gghZpQDDjOy1E21FQgEglGe9QwYO4W5BTfE8Bw91xWir04dUVUXdEDT
 3W1ScR50bwOKzH3Ft8AWTPAbTbIqACozjM9FJT7U0UVFhqrRpF6WxTwd8dGlUtud1N
 nKygt8IhcL1oG8ki2uxMBcqWdLEcbtIIFSN1nnhtSpKS3Iyu6W+/lpJQ1C6502Ov8b
 crQzoXF+ADY7U/heCreq9ts8Lql+bbLrjvjV93DangSS2T6dUnPeEAljkwSXGW36GA
 PQ7bzwZhuTBUoon1f4X9jnvYDjSdt5RKdTj20dfT88NF0QImLO3NIZ8gO62U0d6P+S
 m7Ht9IEkch+p84p+KfgFh2sDR1yaFCJiSNqK93PbYB9rz+3Rr6c3zwoznbQrLtZ0I8
 tByUgMdlGBDpH4Us7ayRd6rKNXOOUcaxVsjSlqwPQaVINmURNOXOu5tC38gTcAEuTD
 82cm4gKdKiiy2jxliZmjxoD0=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED
 autolearn=unavailable autolearn_force=no version=3.4.6
Received: from localhost (unknown [128.0.188.242])
 by wolfsden.cz (Postfix) with ESMTPSA id BA9CE3872C9;
 Thu,  3 Apr 2025 11:27:16 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743679636; bh=tpb5I4x09tfKNj0XJq4fIRifj0gQ7+wcBt74FMo138A=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=nqwNIwz97uv8r4ZqUndu1gLtA5LfMFqJobu+ikklCWvBuSpQEKsIK2rs/Itx8WbR7
 JPfjdP5NcK+8ZEBdZZUrt9bu7NUmJEmZdIg4n4vh3HeurYMTfxvCF8OCn4xLQhK396
 fa1mbSqexZ79XcCJ0KY/bSyw468XMQS7/aCUGXllS52cRsNtLwPZuxQk4F++gO6Nxo
 QzjuD+Ni+8sP+r9+p6tA+uvd0bxCsYb1Xaa85rQ0P0+sqonazPZA+nMWpXP+7rUtjL
 1+0s+Cbj64ZmfaNykMEIjlCp9Od+D68w8b8+ZXkZFtUSIXAe/bfYvaNn/nQpZsEjYj
 LlhG7K93DZWGCXLUlyisKqOjdPloUudZc15jBqX7zSM/o5sOPJSIMsvQ0BPEqJqVDN
 xLiRmC3UrGoE8haUhzdCGoHtgJlkzAStIBbl0l/9JOABkkogO85RPMhGjFI+GsuBGL
 OUs3fcrQqGYAqJmJRBt165wHENeH0dj/v6+Hfv4I/+BFR+roBSqUiW1ClZ7NhwsVTH
 KodnpwahlLpBF073aL5M5iwTwa0Kqcn13XA65iouB08NqSabgvpgONDIydBz1KM8gh
 +fpTrOt7XqSgwTAVWZmIYUZ6G7peMgU7fjId8Wi91KPfZIAQtaChgk4bM05nNfnn0I
 Co87rteptnW+ICbXtcvGXjcQ=
From: Tomas Volf <~@wolfsden.cz>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#77220: [shepherd]: Timers do not set HOME environment
 variable correctly
In-Reply-To: <87h638fams.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Tue, 01 Apr 2025 12:18:19 +0200")
References: <87cye777w3.fsf@HIDDEN> <878qoskow3.fsf@HIDDEN>
 <87y0wr2yyq.fsf@HIDDEN> <87h638fams.fsf@HIDDEN>
Date: Thu, 03 Apr 2025 13:27:16 +0200
Message-ID: <8734epxz6z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 77220
Cc: 77220 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> What would be nice is to provide in (shepherd support) or similar a
> =E2=80=98home-environment-variables=E2=80=99 procedure (or similar) that =
would add HOME=3D
> and USER=3D to the given list of environment variables.
>
> That would avoid duplication of the boilerplate above.
>
> If you=E2=80=99d like to submit such a patch, it=E2=80=99d be welcome!

Would something like the attached work?  I placed the procedure directly
into the (shepherd service) module, since the point is to reduce
boilerplate, I thought it better to not having to specify (modules
'((shepherd support))) every time someone wants to use it, but I can
move it if you prefer.


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-service-Add-user-environment-variables-procedure.patch
Content-Transfer-Encoding: quoted-printable

From f330b8df42b554d6388487df9a81d87bb4ac5071 Mon Sep 17 00:00:00 2001
From: Tomas Volf <~@wolfsden.cz>
Date: Thu, 3 Apr 2025 13:19:26 +0200
Subject: [PATCH] service: Add user-environment-variables procedure.

* modules/shepherd/service.scm (user-environment-variables): New procedure.
* doc/shepherd.texi (Service De- and Constructors): Document it.
* tests/service.scm: And test it.
---
 Makefile.am                  |  1 +
 doc/shepherd.texi            |  9 +++++++++
 modules/shepherd/service.scm | 16 ++++++++++++++-
 tests/service.scm            | 38 ++++++++++++++++++++++++++++++++++++
 4 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 tests/service.scm

diff --git a/Makefile.am b/Makefile.am
index 7404009..a61b403 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -296,6 +296,7 @@ TESTS =3D						\
   tests/syslog-slow-output.sh			\
   tests/terminate-before-running.sh		\
   tests/unload.sh				\
+  tests/service.scm				\
   tests/services/monitoring.sh			\
   tests/services/repl.sh			\
   tests/services/timer.sh			\
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index f826b74..e94496b 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -1203,6 +1203,15 @@ returns when the program starts (@pxref{Runtime Envi=
ronment,
 @code{environ},, guile, GNU Guile Reference Manual}).
 @end defvar
=20
+@deffn {Procedure} user-environment-variables @
+  [name-or-id (getuid)] @
+  [environment-variables (default-environment-variables)]
+
+Take the list of environment variables, replace @env{HOME} with home
+directory of the user and @env{USER} with the name of the user and
+return the result.
+@end deffn
+
 @defvar default-pid-file-timeout
 This parameter (@pxref{Parameters,,, guile, GNU Guile Reference Manual})
 specifies the default PID file timeout in seconds, when
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5477aa5..c03c2c4 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -127,6 +127,7 @@
             default-respawn-delay
             default-service-termination-handler
             default-environment-variables
+            user-environment-variables
             default-service-directory
             make-forkexec-constructor
             make-kill-destructor
@@ -1484,6 +1485,20 @@ background:~{ ~a~}."
   ;; set when starting a service.
   (make-parameter '()))
=20
+(define* (user-environment-variables #:optional
+                                     (name-or-id (getuid))
+                                     (environment-variables
+                                      (default-environment-variables)))
+  "Return the value of @var{environment-variables} with @env{HOME} and
+@env{USER} replaced by correct values for user @var{name-or-id}."
+  (let ((pw (getpw name-or-id)))
+    (cons* (string-append "HOME=3D" (passwd:dir pw))
+           (string-append "USER=3D" (passwd:name pw))
+           (remove (lambda (x)
+                     (or (string-prefix? "HOME=3D" x)
+                         (string-prefix? "USER=3D" x)))
+                   environment-variables))))
+
 (define default-pid-file-timeout
   ;; Maximum number of seconds to wait for a PID file to show up.
   (make-parameter 5))
@@ -2986,4 +3001,3 @@ we want to receive these signals."
       "This does not work for the 'root' service."
       (lambda (running)
 	(local-output (l10n "You must be kidding.")))))))
-
diff --git a/tests/service.scm b/tests/service.scm
new file mode 100644
index 0000000..1826306
--- /dev/null
+++ b/tests/service.scm
@@ -0,0 +1,38 @@
+;; GNU Shepherd --- Test the service module.
+;; Copyright =C2=A9 2025 Tomas Volf <~@wolfsden.cz>
+;;
+;; This file is part of the GNU Shepherd.
+;;
+;; The GNU Shepherd is free software; you can redistribute it and/or modif=
y it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or (at
+;; your option) any later version.
+;;
+;; The GNU Shepherd is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with the GNU Shepherd.  If not, see <http://www.gnu.org/licenses/=
>.
+
+(define-module (test-service)
+  #:use-module (shepherd service)
+  #:use-module (srfi srfi-64))
+
+
+(test-begin "user-environment-variables")
+
+(let ((environment-variables '("USER=3Dfoo"
+                               "HOME=3D/foo"
+                               "USER=3Dbar"
+                               "HOME=3D/bar")))
+  ;; Pretty much any system should have root in /etc/passwd.
+  (test-equal "name sets variables"
+    '("HOME=3D/root" "USER=3Droot")
+    (user-environment-variables "root" environment-variables))
+  (test-equal "id sets variables"
+    '("HOME=3D/root" "USER=3Droot")
+    (user-environment-variables 0 environment-variables)))
+
+(test-end)
--=20
2.49.0


--=-=-=
Content-Type: text/plain


-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

--=-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#77220; Package guix. Full text available.

Message received at 77220 <at> debbugs.gnu.org:


Received: (at 77220) by debbugs.gnu.org; 1 Apr 2025 10:18:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 01 06:18:30 2025
Received: from localhost ([127.0.0.1]:46539 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tzYhR-0003in-IS
	for submit <at> debbugs.gnu.org; Tue, 01 Apr 2025 06:18:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47352)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tzYhP-0003hX-VJ
 for 77220 <at> debbugs.gnu.org; Tue, 01 Apr 2025 06:18:28 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tzYhJ-000823-Tf; Tue, 01 Apr 2025 06:18:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=QWpJ+eBx9lLG0uL+cpamOdzDbeyYaqcmrnk5j8gOZI4=; b=kgd/bCwtE2FVeXXDqKQp
 WdPNTT26Pz1w+2Z7RyiRjHL+QD/hQ/HHB6qViouSw/GjNllfO7LQ339e7+SJaF19EmPlkZt8nKYEG
 mzmo2ek/YOu9SXZtjG0FiWaAb1SJjBKO6DY/3+LBJUeBlUkOp3oq4k6Wctv2O0VNKDmusUB7+WSg1
 B5t1edURu8G1v63rqo44kgBK9fj1QUlwvF9FBQnK4A6glPL1ipOQrmVLBbN/H+jHTGUBvagT/Ji7T
 8N6d82FfsWvR+1I6gg0Yg0L4a/WSmkgtew6FKRIDxHFW5us2PfrtNoHKeT6zTidYleZLMCw+X4OFe
 6CC8yJeUXX/Tiw==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Tomas Volf <~@wolfsden.cz>
Subject: Re: bug#77220: [shepherd]: Timers do not set HOME environment
 variable correctly
In-Reply-To: <87y0wr2yyq.fsf@HIDDEN> (Tomas Volf's message of "Wed, 26
 Mar 2025 23:45:17 +0100")
References: <87cye777w3.fsf@HIDDEN> <878qoskow3.fsf@HIDDEN>
 <87y0wr2yyq.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Duodi 12 Germinal an 233 de la =?utf-8?Q?R=C3=A9volu?=
 =?utf-8?Q?tion=2C?= jour du Charme
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Tue, 01 Apr 2025 12:18:19 +0200
Message-ID: <87h638fams.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 77220
Cc: 77220 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Tomas,

Tomas Volf <~@wolfsden.cz> skribis:

> In case anyone runs into this bug, below is a full version I ended up
> using (user, group, environment-variables are arguments to the wrapping
> function).
>
> #:user #$user
> #:group #$group
> #:environment-variables
> (let ((pw (getpw (or #$user (getuid)))))
>   (cons* (string-append "HOME=3D" (passwd:dir pw))
>          (string-append "USER=3D" (passwd:name pw))
>          (remove (lambda (x)
>                    (or (string-prefix? "HOME=3D" x)
>                        (string-prefix? "USER=3D" x)))
>                  (or '#$environment-variables
>                      (default-environment-variables)))))

What would be nice is to provide in (shepherd support) or similar a
=E2=80=98home-environment-variables=E2=80=99 procedure (or similar) that wo=
uld add HOME=3D
and USER=3D to the given list of environment variables.

That would avoid duplication of the boilerplate above.

If you=E2=80=99d like to submit such a patch, it=E2=80=99d be welcome!

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#77220; Package guix. Full text available.

Message received at 77220 <at> debbugs.gnu.org:


Received: (at 77220) by debbugs.gnu.org; 26 Mar 2025 22:45:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 26 18:45:26 2025
Received: from localhost ([127.0.0.1]:44836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1txZV0-000177-0W
	for submit <at> debbugs.gnu.org; Wed, 26 Mar 2025 18:45:26 -0400
Received: from wolfsden.cz ([37.205.8.62]:58418)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1txZUv-000148-1p
 for 77220 <at> debbugs.gnu.org; Wed, 26 Mar 2025 18:45:23 -0400
Received: by wolfsden.cz (Postfix, from userid 104)
 id 04BB3392F3F; Wed, 26 Mar 2025 22:45:19 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743029119; bh=+Yc1Bk/dNrhE89x5JJ+GOuIo7rwIABqn7unfjkPvDaE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=OCJwZZA54z6VhJNUAfRhi513YSdfFDWGNMfxqqEqC+nJPsQoYyNUyAPUXTCTbV/UE
 tpxkkNvR9s71vE3huFL8wzXMT5u70fFkmQk/LEQbQX1x2hqEE4YYzzXDHy/ksvNAyS
 vrxNs4Tz7CokHgDwuvB3NIo5mxZa9fp2U/atkioxr7nFOgLepRjlGErOr71Je+YERT
 j5nzwwcKrNmAjSzYpdpVtOXtQMRJjGiP1/564PkSqNl1gkb+DZaxi44pJwK7N2hlYT
 bbsl2kiOXv7CMGntHY5MKul/eYlQbeI573wu7ehbePn9PRjM/vhQDhiY8i0UL6abVI
 mH+uia8CATay74bZDBNzFWJzjYlaZguVKAWjFxVWwWpH7fxkyUQ2TDRkVHaxM8uGz9
 ydoX7fo1bJ6+eS5omU43J3rNAVPn1x9f5DEBOZnJs8+r9giM83Ki7JBMNtqrMqmO+w
 O/b4uBHBsQV7dAyBcDZ6s4esnUEsBeIA080qk9f3nMWEqmHmdIbj/HxKQVw+jdEG2f
 ogA2gSY9L/rQPGT6EdxlKUUJ8uNXRO/KRhE/vfGMV6kEVjMSu7PaOwkeGkiEDbccHW
 vWyEqdBhy2F8BXkg3pqOUvMFXgAf6Rh+Il+JDmPvFdQlWAQLQD5DlP6RZ7cy+QADFc
 zjPPI6WYQtgk73iCtauTMHQc=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED
 autolearn=ham autolearn_force=no version=3.4.6
Received: from localhost (unknown [128.0.188.242])
 by wolfsden.cz (Postfix) with ESMTPSA id 2FCF6394220;
 Wed, 26 Mar 2025 22:45:18 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743029118; bh=+Yc1Bk/dNrhE89x5JJ+GOuIo7rwIABqn7unfjkPvDaE=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=fjvG20+6LplajGD8k74JPt3WDRZ9KxKdNGPvKBInVFrTrA1idMNwe1BqDCDsJR7xp
 IxfSGhlUY1Gn2Ru/PDSooNwY2gGWPofeSlhE9GEmMiwUcOORNj4oS6Eq1issngQ66n
 Zp0Q7EZN4uwarbCEBIXFIrKPIhIyzRAzCHu/XTnvwrxuiYPi43vE9+vYwqtJ1ARuur
 59O9wU6PMF5V3aMmldiolSysN237zRmDV5Gn0m1xOn0VesuEIj73jOgZCnw2lAROHB
 FhhTL/msuPgMTs+XRnbB1ltKczKC2uapGvwmlsYC6Y1Av0S/VTMa2CgV40gGAhNwp7
 FXZpEe6V4pQiBTWJ2Not4MJWJbTF+6F9j+/kwCnxb1IPAMHuCHxWg3cfeclsKmDwNJ
 EZ8i1sOoRStvJy4ag1mA2tLmB3OqGNBZ5ZiT9gSLE2N+HmTGZ5JlXuIgpxYU4grE1L
 iOIq/1ERCtlzyMZqfYsEJjf8jaU6PNfbWc9UqEAy28rvM13k7Z45rFqRaJpI0JvJh1
 8MIvEgAm9hmQr4Ue30br0QikWOagOr40uES9VpgSOUHppaTXLXQUluFpiiqlVsCXJ6
 cPmOVhLK1Nn+j4Q1bTh1gteXX+xgWwKBkRJkI1pWZMLZ2/OPJJoPxPCahWO+q1Z/iG
 L5R2l0hGH7N/VU4c/RqC5+w4=
From: Tomas Volf <~@wolfsden.cz>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#77220: [shepherd]: Timers do not set HOME environment
 variable correctly
In-Reply-To: <878qoskow3.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Wed, 26 Mar 2025 12:33:16 +0100")
References: <87cye777w3.fsf@HIDDEN> <878qoskow3.fsf@HIDDEN>
Date: Wed, 26 Mar 2025 23:45:17 +0100
Message-ID: <87y0wr2yyq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 77220
Cc: 77220 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi Tomas,
>
> Tomas Volf <~@wolfsden.cz> skribis:
>
>> Given a timer executed under some user (via #:user "git" #:group "git"
>> keyword arguments), the HOME variable is set to /.  Is that correct?  I
>> get that it might be desirable for a root user, but for regular users
>> that is surprising and causes (for example gitolite from the package of
>> the same name) to not function:
>>
>>   2025-03-23 21:09:06 FATAL: errors found but logfile could not be creat=
ed
>>   2025-03-23 21:09:06 FATAL: //.gitolite/logs/gitolite-2025-03.log: No s=
uch file or directory
>>   2025-03-23 21:09:06 FATAL: die	chdir //.gitolite failed: No such file =
or directory<<newline>>
>>
>> 1. Is this intentional?
>> 2. If yes, is this something you would be opened to changing?
>
> Timers do not set =E2=80=98HOME=E2=80=99 (or any other environment variab=
le) at all.
> That is, they take what=E2=80=99s given in (command =E2=80=A6 #:environme=
nt-variables =E2=80=A6)
> and don=E2=80=99t touch it.
>
> It=E2=80=99s intentional, but the downside is that it can lead to more ve=
rbose
> timer definitions, where would have to explicitly do:
>
>   (command =E2=80=A6 #:environment-variables
>              (cons "HOME=3D/whatever" (default-environment-variables)))
>
> or similar.
>
> How does that sound?

Now that I have tried to actually implement it, I have noticed that I
need to do

--8<---------------cut here---------------start------------->8---
(command =E2=80=A6 #:environment-variables
           (cons "HOME=3D/whatever" (delete "HOME=3D/" (default-environment=
-variables))))
--8<---------------cut here---------------end--------------->8---

Since it seems last occurrence of an environment variable is used, not
first.  Still works, but looks bit ugly I guess.

In case anyone runs into this bug, below is a full version I ended up
using (user, group, environment-variables are arguments to the wrapping
function).

--8<---------------cut here---------------start------------->8---
#:user #$user
#:group #$group
#:environment-variables
(let ((pw (getpw (or #$user (getuid)))))
  (cons* (string-append "HOME=3D" (passwd:dir pw))
         (string-append "USER=3D" (passwd:name pw))
         (remove (lambda (x)
                   (or (string-prefix? "HOME=3D" x)
                       (string-prefix? "USER=3D" x)))
                 (or '#$environment-variables
                     (default-environment-variables)))))
--8<---------------cut here---------------end--------------->8---

Tomas

--=20
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




Information forwarded to bug-guix@HIDDEN:
bug#77220; Package guix. Full text available.

Message received at 77220-done <at> debbugs.gnu.org:


Received: (at 77220-done) by debbugs.gnu.org; 26 Mar 2025 22:11:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 26 18:11:19 2025
Received: from localhost ([127.0.0.1]:44783 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1txYxy-0006UO-S0
	for submit <at> debbugs.gnu.org; Wed, 26 Mar 2025 18:11:19 -0400
Received: from wolfsden.cz ([37.205.8.62]:33452)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1txYxu-0006Tm-Sx
 for 77220-done <at> debbugs.gnu.org; Wed, 26 Mar 2025 18:11:16 -0400
Received: by wolfsden.cz (Postfix, from userid 104)
 id 3F40E392DA3; Wed, 26 Mar 2025 22:11:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743027073; bh=rzU3z29HCOa4d/AncowrJSodQW7udEiy3GO32XVT6bk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=e43yAZSgXBdYzvXls+6AEuTbDYgOIm6a75QkxcUQtpJJFpQNwEnNf8AjjUlWhkNkq
 qWQWAyGp1cQSz89sBWBU3YB50niQNYU8iBEP3HqwRxVlXZ/NaWSBRSmsxqYJH2Uoq5
 5mB1Fk5pDKzuJNRKQ0k5Z6GcE5fYS+zy58BMhUCkYIRid7cOU0GyTGTYtS9pcUvJIt
 1ctzzdOOJa0hOrrp/aAu87oQf+eRuUlP2BdX7T/as80QoicoF9c0vm/qcDBRRebYZz
 Tqo3I8xVHgWQY+f4j2VodGi20b867uiocXmNR10uLVWiryNGNnlIFajWaHynrFw7FT
 0NNj8tBaecLiOwt+/RvKYXHk4yEEgvgKzbOVtQaZHgCLrMLV33Fr1VXnp0sYmVbw+x
 9EiVPS62hD2UEo7dmfm8k8DHExWo9F4hfh047FuEYcKGe/X1KQqSboLyOZoEAe//N4
 wQfAg7zspSpunSlVbxTQCVl0s2lsIR03Fb9Zaws+Tap9MKLqElvIpZIge6EyJF6BxV
 WHaBSrHFJQzCt+x2HF7ATQHxJ9Dm1AHonS/qXuld2Zso55DASqcUxjHCoLodowziHZ
 dBnt2M3qv+y0nNdZ9Uj3NiFiYnHJ/ITc3OlLFykBf4/BjSu3+764+4XfO3Ie8OcBGH
 NbB6ZqVXmVv75npbgKoy5Qsc=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED
 autolearn=ham autolearn_force=no version=3.4.6
Received: from localhost (unknown [128.0.188.242])
 by wolfsden.cz (Postfix) with ESMTPSA id 09B4F39205C;
 Wed, 26 Mar 2025 22:11:07 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1743027067; bh=rzU3z29HCOa4d/AncowrJSodQW7udEiy3GO32XVT6bk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=PFWd7wa2SycoIGgKWDFsR3r1J07MLS3Y2a3xP6/9LYCmyKH4+MSKeK67xCmAswWLC
 xsAluj9uneG8qy9Oz7P7xpzMINVUapxIujLiKGm1tvmqmrwDABwl5TMRphLVXAZ1Lt
 kKy9HYdOAaHO69P9eflDWBk0a0XdU2VAJ2llahVejABWgwJQtpvRFtS95wq4xDnviF
 PGNWPnbew9F4Pi+dflyK6N+qYD/9gyTS2fhKlMfMjsmZ3LO94VuBNlAkAE8A9I/VaW
 oX0FsnGMNWtDCmZ5rUtgWY1TuZ+vW2q/hZtdkxZ8QPgIq1GPMlYdAEK964XAW46z7Y
 P2vCREYgO6BQIzf33GbYAaH484AHlpwByKRUjUSePFbLomr5kRTmSY2XcNMQe6d/5E
 rpx9otAHF+d8sP+utJ4p4otRY9Us1Um5m6Vs+RvMnfDxQptkqM0QdCgl+HedNyNXM5
 +TKcVOhp3nBIjul0DyA1+v1/hPyF83lRgtx4UwjsM3IvyJgYFuA1cg3CVTP1yCsozG
 0ykk+mHgZl153HF8bABxb+vd7qQ5ZPxARgRkbK5dFAc/BihrgRQmMG5hXl+fsFLgEQ
 SPiH34CZyjsDdNhqt0oHTbEiUO6OAvZUH2in7dajlU29WP9ysyQ3eswx5jbSsHkeNN
 ynJQaNKR/+XVeAqkMJX4tf8Q=
From: Tomas Volf <~@wolfsden.cz>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#77220: [shepherd]: Timers do not set HOME environment
 variable correctly
In-Reply-To: <878qoskow3.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Wed, 26 Mar 2025 12:33:16 +0100")
References: <87cye777w3.fsf@HIDDEN> <878qoskow3.fsf@HIDDEN>
Date: Wed, 26 Mar 2025 23:11:06 +0100
Message-ID: <87a5974f45.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 77220-done
Cc: 77220-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi Tomas,
>
> Tomas Volf <~@wolfsden.cz> skribis:
>
>> Given a timer executed under some user (via #:user "git" #:group "git"
>> keyword arguments), the HOME variable is set to /.  Is that correct?  I
>> get that it might be desirable for a root user, but for regular users
>> that is surprising and causes (for example gitolite from the package of
>> the same name) to not function:
>>
>>   2025-03-23 21:09:06 FATAL: errors found but logfile could not be creat=
ed
>>   2025-03-23 21:09:06 FATAL: //.gitolite/logs/gitolite-2025-03.log: No s=
uch file or directory
>>   2025-03-23 21:09:06 FATAL: die	chdir //.gitolite failed: No such file =
or directory<<newline>>
>>
>> 1. Is this intentional?
>> 2. If yes, is this something you would be opened to changing?
>
> Timers do not set =E2=80=98HOME=E2=80=99 (or any other environment variab=
le) at all.
> That is, they take what=E2=80=99s given in (command =E2=80=A6 #:environme=
nt-variables =E2=80=A6)
> and don=E2=80=99t touch it.
>
> It=E2=80=99s intentional, but the downside is that it can lead to more ve=
rbose
> timer definitions, where would have to explicitly do:
>
>   (command =E2=80=A6 #:environment-variables
>              (cons "HOME=3D/whatever" (default-environment-variables)))
>
> or similar.
>
> How does that sound?

It sounds... verbose. :)  In practice it cannot be

--8<---------------cut here---------------start------------->8---
(command =E2=80=A6 #:environment-variables
           (cons "HOME=3D/whatever" (default-environment-variables)))
--8<---------------cut here---------------end--------------->8---

but something like

--8<---------------cut here---------------start------------->8---
(command =E2=80=A6 #:environment-variables
           (cons (string-append "HOME=3D"
                                (passwd:dir (getpwnam "whatever")))
                 (default-environment-variables)))
--8<---------------cut here---------------end--------------->8---

I do however see your point, I simply need to get the timer =3D=3D cron
approximation out of my head.  I am viewing it too much through "this is
cron" lenses.  I just add this (setting the home) into my wrapper.

I am closing this bug, since there is nothing to do here.

Thanks for the explanation,
Tomas

--=20
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




Notification sent to Tomas Volf <~@wolfsden.cz>:
bug acknowledged by developer. Full text available.
Reply sent to Tomas Volf <~@wolfsden.cz>:
You have taken responsibility. Full text available.

Message received at 77220 <at> debbugs.gnu.org:


Received: (at 77220) by debbugs.gnu.org; 26 Mar 2025 11:33:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 26 07:33:34 2025
Received: from localhost ([127.0.0.1]:41768 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1txP0o-0000bI-10
	for submit <at> debbugs.gnu.org; Wed, 26 Mar 2025 07:33:34 -0400
Received: from hera.aquilenet.fr ([185.233.100.1]:59000)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1txP0k-0000at-2f
 for 77220 <at> debbugs.gnu.org; Wed, 26 Mar 2025 07:33:31 -0400
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id E786678;
 Wed, 26 Mar 2025 12:33:18 +0100 (CET)
Authentication-Results: hera.aquilenet.fr;
	none
X-Virus-Scanned: Debian amavis at hera.aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP
 id E6KOHDEkrFrw; Wed, 26 Mar 2025 12:33:18 +0100 (CET)
Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id CB742A7E;
 Wed, 26 Mar 2025 12:33:16 +0100 (CET)
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Tomas Volf <~@wolfsden.cz>
Subject: Re: bug#77220: [shepherd]: Timers do not set HOME environment
 variable correctly
In-Reply-To: <87cye777w3.fsf@HIDDEN> (Tomas Volf's message of "Sun, 23
 Mar 2025 22:29:48 +0100")
References: <87cye777w3.fsf@HIDDEN>
Date: Wed, 26 Mar 2025 12:33:16 +0100
Message-ID: <878qoskow3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Rspamd-Queue-Id: E786678
X-Spamd-Result: default: False [4.90 / 15.00]; SPAM_FLAG(5.00)[];
 BAYES_HAM(-3.00)[100.00%]; NEURAL_SPAM(3.00)[0.999];
 MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_TWO(0.00)[2];
 FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+];
 RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[];
 TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];
 RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[];
 MID_RHS_MATCH_FROM(0.00)[]
X-Spam-Level: ****
X-Rspamd-Action: no action
X-Spamd-Bar: ++++
X-Rspamd-Server: hera
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 77220
Cc: 77220 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi Tomas,

Tomas Volf <~@wolfsden.cz> skribis:

> Given a timer executed under some user (via #:user "git" #:group "git"
> keyword arguments), the HOME variable is set to /.  Is that correct?  I
> get that it might be desirable for a root user, but for regular users
> that is surprising and causes (for example gitolite from the package of
> the same name) to not function:
>
>   2025-03-23 21:09:06 FATAL: errors found but logfile could not be created
>   2025-03-23 21:09:06 FATAL: //.gitolite/logs/gitolite-2025-03.log: No su=
ch file or directory
>   2025-03-23 21:09:06 FATAL: die	chdir //.gitolite failed: No such file o=
r directory<<newline>>
>
> 1. Is this intentional?
> 2. If yes, is this something you would be opened to changing?

Timers do not set =E2=80=98HOME=E2=80=99 (or any other environment variable=
) at all.
That is, they take what=E2=80=99s given in (command =E2=80=A6 #:environment=
-variables =E2=80=A6)
and don=E2=80=99t touch it.

It=E2=80=99s intentional, but the downside is that it can lead to more verb=
ose
timer definitions, where would have to explicitly do:

  (command =E2=80=A6 #:environment-variables
             (cons "HOME=3D/whatever" (default-environment-variables)))

or similar.

How does that sound?

Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#77220; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Mar 2025 21:30:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 23 17:30:05 2025
Received: from localhost ([127.0.0.1]:52872 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twStQ-0006Sg-Mu
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 17:30:05 -0400
Received: from lists.gnu.org ([2001:470:142::17]:50902)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1twStN-0006R2-7B
 for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 17:30:02 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1twStH-0006yr-HS
 for bug-guix@HIDDEN; Sun, 23 Mar 2025 17:29:55 -0400
Received: from wolfsden.cz ([37.205.8.62])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1twStF-00071p-24
 for bug-guix@HIDDEN; Sun, 23 Mar 2025 17:29:55 -0400
Received: by wolfsden.cz (Postfix, from userid 104)
 id EE85B38501A; Sun, 23 Mar 2025 21:29:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1742765389; bh=sGlg2xYK899wPEN8WZytbDuHD6WzsMtZfmnpuqrdXh0=;
 h=From:To:Subject:Date;
 b=HAU3gd5TnWXffr2fpURS8KjWHzcUO9vhAFQGx8xxvlyBBDTnd0jcnopR1xbXFJug9
 unJJDP3CB6aGAWvvVRJTup1PZJt0T1Bcb5DPfLC3hl0JbK3dl2AJkelaIfj1fHvcB0
 YRwRIgSu4Xk0WkI2Zi2KlXfShFj27DxfYZFDC3Vh1SzUFQROAwPjAA/7xAqLCBJmFn
 F3wQdTFgxGkVVhu1dp2KTBC7rWlTt6ckHFQ7r/W/dk9OTcegzRpeT3XO86qmf5bfo6
 JeLJRLyPElhw3mZbtWBI0BRSOFKTPbXTWZQxiJKwG6wl33M2EsDhrEra0ANRrtrffS
 1dI2XsxsWigGiLELnJuy2DC4vMXLOPBwLYgc/NrMjMqDxDoOt1wDqm4vOXNWoISgAQ
 l9orckzEcTNME3kmh4q9T7mib8F1BavULMQSM6VYd6/k45YGo2uzfoRmF64K1I6pq8
 o2Z1nH071OcxIbGQEBDbHE+lhso6hscMVIR4UXYuw72gKiEXqdqq5Az9GUHq5cYi6E
 eJA3GdkbcHKSjMUO8XXssx8Pmc0uY5zBJOPQ8uYIlDfj8nmIE9yH9sWkbUxZtRe0P9
 YR6KMSLfl5ofsZkh4cs7Hd73rGB6PILGa0zMFy2nQjh+kBtA0RDU6PTPYLnsVBfY0y
 Qy1X0yCqtlreS0nRLbKpYfto=
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden
X-Spam-Level: 
X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00,
 DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED
 autolearn=ham autolearn_force=no version=3.4.6
Received: from localhost (unknown [128.0.188.242])
 by wolfsden.cz (Postfix) with ESMTPSA id 1F40738531B
 for <bug-guix@HIDDEN>; Sun, 23 Mar 2025 21:29:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail;
 t=1742765389; bh=sGlg2xYK899wPEN8WZytbDuHD6WzsMtZfmnpuqrdXh0=;
 h=From:To:Subject:Date;
 b=HAU3gd5TnWXffr2fpURS8KjWHzcUO9vhAFQGx8xxvlyBBDTnd0jcnopR1xbXFJug9
 unJJDP3CB6aGAWvvVRJTup1PZJt0T1Bcb5DPfLC3hl0JbK3dl2AJkelaIfj1fHvcB0
 YRwRIgSu4Xk0WkI2Zi2KlXfShFj27DxfYZFDC3Vh1SzUFQROAwPjAA/7xAqLCBJmFn
 F3wQdTFgxGkVVhu1dp2KTBC7rWlTt6ckHFQ7r/W/dk9OTcegzRpeT3XO86qmf5bfo6
 JeLJRLyPElhw3mZbtWBI0BRSOFKTPbXTWZQxiJKwG6wl33M2EsDhrEra0ANRrtrffS
 1dI2XsxsWigGiLELnJuy2DC4vMXLOPBwLYgc/NrMjMqDxDoOt1wDqm4vOXNWoISgAQ
 l9orckzEcTNME3kmh4q9T7mib8F1BavULMQSM6VYd6/k45YGo2uzfoRmF64K1I6pq8
 o2Z1nH071OcxIbGQEBDbHE+lhso6hscMVIR4UXYuw72gKiEXqdqq5Az9GUHq5cYi6E
 eJA3GdkbcHKSjMUO8XXssx8Pmc0uY5zBJOPQ8uYIlDfj8nmIE9yH9sWkbUxZtRe0P9
 YR6KMSLfl5ofsZkh4cs7Hd73rGB6PILGa0zMFy2nQjh+kBtA0RDU6PTPYLnsVBfY0y
 Qy1X0yCqtlreS0nRLbKpYfto=
From: Tomas Volf <~@wolfsden.cz>
To: bug-guix@HIDDEN
Subject: [shepherd]: Timers do not set HOME environment variable correctly
Date: Sun, 23 Mar 2025 22:29:48 +0100
Message-ID: <87cye777w3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz;
 helo=wolfsden.cz
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hi,

I am in a process of porting my crontabs over to shepherd timers and
noticed a difference.

Given a timer executed under some user (via #:user "git" #:group "git"
keyword arguments), the HOME variable is set to /.  Is that correct?  I
get that it might be desirable for a root user, but for regular users
that is surprising and causes (for example gitolite from the package of
the same name) to not function:

--8<---------------cut here---------------start------------->8---
  2025-03-23 21:09:06 FATAL: errors found but logfile could not be created
  2025-03-23 21:09:06 FATAL: //.gitolite/logs/gitolite-2025-03.log: No such file or directory
  2025-03-23 21:09:06 FATAL: die	chdir //.gitolite failed: No such file or directory<<newline>>
--8<---------------cut here---------------end--------------->8---

1. Is this intentional?
2. If yes, is this something you would be opened to changing?

Or at least, if this is intentional, would it not be better to not set
HOME at all instead of to a wrong value?

For the time being, I will just do `HOME=~git' as a first line of all
the scripts, but it is not great having to do that everywhere.

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.




Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#77220; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 3 Apr 2025 11:30:02 UTC

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