GNU bug report logs -
#78603
[PATCH] services: readymedia: Respect SUDO_HOME if configuring for home.
Previous Next
Full log
Message #11 received at 78603 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Tuesday, May 27, 2025 5:15:10 PM GMT+5:30 Sergey Trofimov wrote:
> Hi Sughosha,
>
> Sughosha <sughosha <at> disroot.org> writes:
> > This fixes the service that is configured for a home environment,
> > defined with "guix-home-service-type" in a system configuration, using
> > "sudo", with "/root" as "$HOME" instead of the required home directory.
> >
> > * gnu/services/upnp.scm (readymedia-configuration)[cache-directory]:
> > Respect SUDO_HOME if configuring for home.
> > [log-directory]: Ditto.
> >
> > Change-Id: Ie6905c0b83608f91582671cde9d866079178f192
> > ---
> >
> > gnu/services/upnp.scm | 25 ++++++++++++++-----------
> > 1 file changed, 14 insertions(+), 11 deletions(-)
> >
> > diff --git a/gnu/services/upnp.scm b/gnu/services/upnp.scm
> > index 8267b1e53af..edd55594e38 100644
> > --- a/gnu/services/upnp.scm
> > +++ b/gnu/services/upnp.scm
> > @@ -74,19 +74,22 @@ (define-record-type* <readymedia-configuration>
> >
> > (default #f))
> >
> > (cache-directory readymedia-configuration-cache-directory
> >
> > (default (if for-home?
> >
> > - (string-append (or (getenv
> > "XDG_CACHE_HOME") -
> > (string-append -
> > (getenv "HOME") "/.cache")) -
> > "/readymedia")
> > - %readymedia-default-cache-directory)))
> > + (if (getenv "XDG_CACHE_HOME")
> > + (string-append (getenv
> > "XDG_CACHE_HOME") +
> > "/readymedia") + (string-append (or
> > (getenv "SUDO_HOME") +
> > (getenv "HOME")) +
> > "/.cache/readymedia")) +
> > %readymedia-default-cache-directory)))
> That's a brittle solution: this code runs when the file is loaded,
> setting the defaults to the values of host environment. This is not what
> you generally want, because the target environment might be different,
> i.e. I might be building home profile for another user and the resulting
> config should contain their username.
>
> Check how `syncthing-configuration` works. I think that the simplest
> solution would be to use relative paths for installations to user homes.
> The shepherd service is run from the $HOME, so just
> `db_dir=.cache/readymedia` should work. If the user wants to use XDG
> dirs, they should pass the correct values explicitly.
Using relative paths without any variable is working. I will send v2 patch.
--
Sughosha
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 36 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.