[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50945: Guix home: No such file or directory: "/run/user/1003/on-firs

From: Ludovic Courtès
Subject: bug#50945: Guix home: No such file or directory: "/run/user/1003/on-first-login-executed"
Date: Sun, 14 Nov 2021 23:11:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Andrew and all,

Andrew Tropin <andrew@trop.in> skribis:

> On 2021-11-05 17:58, Xinglu Chen wrote:
> From 8b924b02ab917632047d6653f19d9b16175989bf Mon Sep 17 00:00:00 2001
> From: Andrew Tropin <andrew@trop.in>
> Date: Thu, 7 Oct 2021 08:12:04 +0300
> Subject: [PATCH] home-services: on-first-login: Check if XDG_RUNTIME_DIR
>  exists.
> * gnu/home-services.scm (on-first-login): on-first-login won't execute
> anything if XDG_RUNTIME_DIR doesn't exists.

Applied, with a “Fixes” line in the commit log.  However…

> +++ b/gnu/home/services.scm
> @@ -286,8 +286,13 @@ (define (compute-on-first-login-script _ gexps)
>         ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick
>         ;; allows to launch on-first-login script on first login only
>         ;; after complete logout/reboot.
> -       (when (not (file-exists? flag-file-path))
> -         (begin #$@gexps (touch flag-file-path))))))
> +       (if (file-exists? xdg-runtime-dir)
> +           (unless (file-exists? flag-file-path)
> +             (begin #$@gexps (touch flag-file-path)))
> +           (display "XDG_RUNTIME_DIR doesn't exists, on-first-login script
> +won't execute anything.  You can check if xdg runtime directory exists,
> +XDG_RUNTIME_DIR variable is set to apropriate value and manually execute the
> +script by running '$HOME/.guix-home/on-first-login'")))))

This pattern is problematic because this text is not internationalized
(not subject to translation).  Part of caring about users in Guix
implies ensuring that all messages are internationalized.

The fact that the text is embedded in a generated script makes it a
little trickier.  In the installer, we address that by using the message
catalog of the ‘guix’ package like so:

        (bindtextdomain "guix" (string-append #$guix "/share/locale"))
        (textdomain "guix")
        (setlocale LC_ALL ""))

The downside is that the script ends up depending on the ‘guix’ package;
we could optimize that later on.

At any rate, for these cases where you cannot avoid having messages
printed by generated scripts such as this one, the solution would be to:

  1. Add calls to ‘bindtextdomain’ and ‘textdomain’ as above
     (‘setlocale’ no longer needs to be called explicitly).

  2. Import (guix i18n) and wrap messages in ‘G_’ (or ‘N_’) calls.

  3. Ensure that each file that uses ‘G_’ or ‘N_’ is listed in

Could one of you take a look?  :-)

> Also, added a note about elogind/XDG_RUNTIME_DIR to manual.
> From f5d35fd4f542a11226c0159ee32498e374ff40a2 Mon Sep 17 00:00:00 2001
> From: Andrew Tropin <andrew@trop.in>
> Date: Mon, 8 Nov 2021 12:22:04 +0300
> Subject: [PATCH] doc: Add a note about elogind and XDG_RUNTIME_DIR for Guix
>  Home.
> * doc/guix.texi (Declaring the Home Environment): Add a note about elogind and

I tweaked the wording and applied.  Thank you!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]