unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65471: home mcron service overwrites PATH with a GuixSD-only directory
@ 2023-08-23 10:22 nils
  2023-11-20 22:10 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: nils @ 2023-08-23 10:22 UTC (permalink / raw)
  To: 65471

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hello,
 
when using the home-mcron-service, PATH is set to /run/current-system/profile/bin . This directory is empty when using guix home on a foreign distro, meaning all executable paths would need to be absolute. This includes stuff like /usr/bin/ssh, /usr/bin/nice etc..
 
My guess for the culprit was 1c30d5a6bfc5d48137f4bdcc271189a06fdc6ed3 , which replaced the custom home-mcron-service-type with mapping it to mcron-service-type. 
The mcron shepherd service in old service type did not mess with the environment variables, the inherited one does:
#:environment-variables
(cons* "GUILE_AUTO_COMPILE=0"
"PATH=/run/current-system/profile/bin"
(remove (cut string-prefix? "PATH=" <>)
(environ)))
 
Strange thing is that the commit is from 2023-08-06, and I update guix almost every day, but did not run into the issue until today. But the commit seems to fit the issue perfectly, so I'm not sure what's going on at all.

[-- Attachment #2: Type: text/html, Size: 1454 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#65471: home mcron service overwrites PATH with a GuixSD-only directory
  2023-08-23 10:22 bug#65471: home mcron service overwrites PATH with a GuixSD-only directory nils
@ 2023-11-20 22:10 ` Ludovic Courtès
  2023-11-21  0:46   ` Oleg Pykhalov
  2023-11-21 15:09   ` Nils Landt
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2023-11-20 22:10 UTC (permalink / raw)
  To: nils; +Cc: 65471

Hi,

Apologies for the delay.

nils@landt.email skribis:

> when using the home-mcron-service, PATH is set to /run/current-system/profile/bin . This directory is empty when using guix home on a foreign distro, meaning all executable paths would need to be absolute. This includes stuff like /usr/bin/ssh, /usr/bin/nice etc..
>  
> My guess for the culprit was 1c30d5a6bfc5d48137f4bdcc271189a06fdc6ed3 , which replaced the custom home-mcron-service-type with mapping it to mcron-service-type. 
> The mcron shepherd service in old service type did not mess with the environment variables, the inherited one does:
> #:environment-variables
> (cons* "GUILE_AUTO_COMPILE=0"
> "PATH=/run/current-system/profile/bin"
> (remove (cut string-prefix? "PATH=" <>)
> (environ)))

As a rule of thumb, I personally always provide absolute file names, as
in #~(job … #$(file-append coreutils "/bin/ls") …).

I wonder what the preferred behavior would be.  Restore PATH to whatever
value it had when the user ‘shepherd’ process was started, at the
expense of making things harder to track/less reproducible?  Should we
leave it unset, possibly breaking programs that expect it to be set?
Should we set it to “/run/current-system/profile/bin:/usr/bin” or
similar?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#65471: home mcron service overwrites PATH with a GuixSD-only directory
  2023-11-20 22:10 ` Ludovic Courtès
@ 2023-11-21  0:46   ` Oleg Pykhalov
  2023-11-21 15:09   ` Nils Landt
  1 sibling, 0 replies; 4+ messages in thread
From: Oleg Pykhalov @ 2023-11-21  0:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 65471

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:
[…]

> I wonder what the preferred behavior would be.  Restore PATH to whatever
> value it had when the user ‘shepherd’ process was started, at the
> expense of making things harder to track/less reproducible?  Should we
> leave it unset, possibly breaking programs that expect it to be set?
> Should we set it to “/run/current-system/profile/bin:/usr/bin” or
> similar?

1c30d5a6 was almost 3 months ago, so we could assume most of the users
are already reconfigured to this (or newer) commit and fixed their
configurations accordingly.

Because we probably cannot be sure how they fixed it, I think the best
that we could do is not to change the current behavior again and provide
a support and documentation if needed, so we don't break users
configurations again.

Also, the current behavior ‘PATH=/run/current-system/profile/bin’
matches with mcron started by Shepherd on a Guix System on pretty recent
commit ‘fc6bdaad57bf91609849623c5f485403c030cb49’, which probably is
better than difference of PATH dependending on is it system's Shepherd
or user's Shepherd instance running.

We could allow users to control an environment of mcron, but I think it
should be:

- optional for both system's and user's Shepherd instances;
- not a default behavior, because we already switched from PATH=<IMPURE>
  to ‘PATH=/run/current-system/profile/bin’.


Regards,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#65471: home mcron service overwrites PATH with a GuixSD-only directory
  2023-11-20 22:10 ` Ludovic Courtès
  2023-11-21  0:46   ` Oleg Pykhalov
@ 2023-11-21 15:09   ` Nils Landt
  1 sibling, 0 replies; 4+ messages in thread
From: Nils Landt @ 2023-11-21 15:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 65471

> Ludovic Courtès <ludo@gnu.org> hat am 20.11.2023 23:10 CET geschrieben:

> nils@landt.email skribis:
> 
> > when using the home-mcron-service, PATH is set to /run/current-system/profile/bin . This directory is empty when using guix home on a foreign distro, meaning all executable paths would need to be absolute. This includes stuff like /usr/bin/ssh, /usr/bin/nice etc..
> >  
> > My guess for the culprit was 1c30d5a6bfc5d48137f4bdcc271189a06fdc6ed3 , which replaced the custom home-mcron-service-type with mapping it to mcron-service-type. 
> > The mcron shepherd service in old service type did not mess with the environment variables, the inherited one does:
> > #:environment-variables
> > (cons* "GUILE_AUTO_COMPILE=0"
> > "PATH=/run/current-system/profile/bin"
> > (remove (cut string-prefix? "PATH=" <>)
> > (environ)))
> 
> As a rule of thumb, I personally always provide absolute file names, as
> in #~(job … #$(file-append coreutils "/bin/ls") …).

I do the same, but occasionally a program I call expects something to be available in PATH. For me (guix home in Debian 12), this includes Guix itself.
Running 
/home/nl/.config/guix/current/bin/guix pull 
in a terminal works perfectly fine, but
unset PATH
/home/nl/.config/guix/current/bin/guix pull 
results in a stacktrace that ends in:
In guix/scripts/pull.scm:
    453:4  4 (_)
In guix/build/utils.scm:
    625:6  3 (which "guix")
In unknown file:
           2 (string-tokenize #f #<charset {#\nul..#\9 #\;..#\15377…> …)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string-tokenize: Wrong type argument in position 1 (expecting string): #f

> I wonder what the preferred behavior would be.  Restore PATH to whatever
> value it had when the user ‘shepherd’ process was started, at the
> expense of making things harder to track/less reproducible?  Should we
> leave it unset, possibly breaking programs that expect it to be set?
> Should we set it to “/run/current-system/profile/bin:/usr/bin” or
> similar?

I think the previous behaviour was fine for a user level service. I'm guessing this was inheriting the environment variables from the shepherd process that started mcron?

Otherwise, adding /usr/local/bin:/usr/bin:/bin should be a good default I think.

I'm not emotionally invested either way, I have moved away from shepherd / mcron.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-21 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 10:22 bug#65471: home mcron service overwrites PATH with a GuixSD-only directory nils
2023-11-20 22:10 ` Ludovic Courtès
2023-11-21  0:46   ` Oleg Pykhalov
2023-11-21 15:09   ` Nils Landt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).