guix-patches
[Top][All Lists]
Advanced

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

[bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services


From: Ludovic Courtès
Subject: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ)
Date: Sat, 09 Oct 2021 00:57:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust@gmail.com>
> Date: Tue, 5 Oct 2021 02:10:25 +0300
> Subject: [PATCH] scripts: home: Make sure profile directory exists.
>
> * guix/scripts/home.scm (process-action): Make sure profile directory exists.
> * tests/guix-home.sh: New file.
> * Makefile.am (SH_TESTS): Add this.

IMO the home.scm change should perhaps be a separate commit because it’s
not strictly what the test exercises.

> +++ b/tests/guix-home.sh
> @@ -0,0 +1,86 @@
> +#!/usr/bin/env bash
> +

You can remove these two lines.

> +run_guix_home_without_home()
> +{
> +    (
> +        # Save current directory (Guix source directory) for later mount
> +        test_directory="$(mktemp -d)"
> +        trap 'umount $test_directory; rmdir $test_directory' EXIT
> +        mount --bind "$PWD" "$test_directory"
> +
> +        # Make $HOME directory empty to preserve user's files
> +        mount --types tmpfs none "$HOME"
> +
> +        # Mount Guix source directory in a clean environment
> +        mkdir -p "$PWD"
> +        mount --bind "$test_directory" "$PWD"
> +        cd "$PWD" || exit 77

How about ‘set -e’ to make sure we abort as soon as things go wrong?

Also, wouldn’t it be easier to set HOME to a new directory?

> +        guix home reconfigure "${test_directory}/home.scm"

Looks like the test is not checking anything after ‘reconfigure’ has
completed.  Should it check for the presence of certain things in
~/.bashrc, for the presence of ~/.guix-home, the output of ‘guix home
describe’ maybe?

> +unshare -mrf bash -c "run_guix_home_without_home"

If we keep this strategy (rather than setting HOME), we need a check for
unprivileged user namespace support.  In
‘tests/guix-pack-relocatable.sh’, this is done by invoking “unshare -r
true” and checking the return value.

Could you send an updated patch?

Thanks,
Ludo’.





reply via email to

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