unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Tropin <andrew@trop.in>
Cc: 50945@debbugs.gnu.org, Xinglu Chen <public@yoctocell.xyz>
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	[thread overview]
Message-ID: <87sfvy8k1u.fsf@gnu.org> (raw)
In-Reply-To: <87o86vgfu4.fsf@trop.in> (Andrew Tropin's message of "Mon, 08 Nov 2021 12:24:35 +0300")

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:

    #~(begin
        (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
     po/guix/POTFILES.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
> XDG_RUNTIME_DIR.

I tweaked the wording and applied.  Thank you!

Ludo’.




      reply	other threads:[~2021-11-14 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 15:46 bug#50945: Guix home: No such file or directory: "/run/user/1003/on-first-login-executed" Jan Nieuwenhuizen
2021-10-01 17:05 ` Xinglu Chen
2021-10-07  5:21 ` Andrew Tropin
2021-11-05 16:58   ` Xinglu Chen
2021-11-08  9:24     ` Andrew Tropin
2021-11-14 22:11       ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfvy8k1u.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=50945@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=public@yoctocell.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).