GNU bug report logs - #77707
[shepherd] chdir and invoke do not work as intended in services

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Thu, 10 Apr 2025 14:45:02 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


Message #10 received at 77707-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> chbouib.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 77707-done <at> debbugs.gnu.org
Subject: Re: bug#77707: [shepherd] chdir and invoke do not work as intended
 in services
Date: Sun, 13 Apr 2025 21:52:29 +0200
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> +                             (start #~(lambda _
> +                                        (mkdir "/etc/testdir")
> +                                        (chdir "/etc/testdir")
> +                                        (invoke #$(file-append coreutils "/bin/touch")
> +                                                "new-file.txt")

[...]

> You should see upon inspection that:
>
> root <at> komputilo ~# ls /new-file.txt 
> /new-file.txt                        # wrong place
> root <at> komputilo ~# ls /etc/testdir/   # empty

That’s because ‘invoke’ uses ‘system*’, which is in fact within the
‘shepherd’ process an alias for ‘spawn-command’.

This is fixed in 8d88024e0898dd7d4581c4e977c9786af734a855, which will be
in 1.0.4.

However generally speaking it’s a good idea to leave the current
directory of the ‘shepherd’ process unchanged as bad things could happen
otherwise (though ‘with-directory-excursion’ from (shepherd support)
should be safe.)

Thanks,
Ludo’.




This bug report was last modified 96 days ago.

Previous Next


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