Subject: [bug#78603] [PATCH] services: readymedia: Respect SUDO_HOME if configuring for home.

From: Ludovic Courtès <[email-masked]>
Date: Thu, 12 Jun 2025 09:58:32 +0200

Hi,

Sughosha <[email-masked]> writes:

> This fixes readymedia configured by a different user.
>
> * gnu/services/upnp.scm (readymedia-configuration)[cache-directory]: Update
> path.
> [log-directory]: Ditto.
>
> Change-Id: I629c937973ca46bcd6e60382aa7576b9859515be

[...]

>                     (default (if for-home?
> -                                (string-append (or (getenv "XDG_CACHE_HOME")
> -                                                   (string-append
> -                                                    (getenv "HOME") "/.cache"))
> -                                               "/readymedia")
> -                              %readymedia-default-cache-directory)))
> +                                ".cache/readymedia"
> +                                %readymedia-default-cache-directory)))

A better solution, to avoid brittleness associated with relative
file names, is to turn ‘cache-directory’ into a gexp that would ‘getenv’
as above and/or ‘getpw’ to determine the cache directory name.

The (shepherd support) module provides ‘%user-log-dir’ etc., but
unfortunately it lacks ‘%user-cache-dir’.

HTH,
Ludo’.