From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WIb2FjIgXmEGVAEAgWs5BA (envelope-from ) for ; Thu, 07 Oct 2021 00:16:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qO+gEjIgXmFNdgAAB5/wlQ (envelope-from ) for ; Wed, 06 Oct 2021 22:16:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 82805E3EA for ; Thu, 7 Oct 2021 00:16:17 +0200 (CEST) Received: from localhost ([::1]:33948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYFCy-0000qI-Jb for larch@yhetil.org; Wed, 06 Oct 2021 18:16:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYFCk-0000oY-Se for guix-patches@gnu.org; Wed, 06 Oct 2021 18:16:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYFCk-0001sn-A7 for guix-patches@gnu.org; Wed, 06 Oct 2021 18:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYFCk-0007Wv-5j for guix-patches@gnu.org; Wed, 06 Oct 2021 18:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ) Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Oct 2021 22:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 50967@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin , Xinglu Chen , zimoun Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163355856028933 (code B ref 50967); Wed, 06 Oct 2021 22:16:02 +0000 Received: (at 50967) by debbugs.gnu.org; 6 Oct 2021 22:16:00 +0000 Received: from localhost ([127.0.0.1]:45686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYFCY-0007WP-3E for submit@debbugs.gnu.org; Wed, 06 Oct 2021 18:16:00 -0400 Received: from mail-lf1-f45.google.com ([209.85.167.45]:44787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYFCV-0007WC-Jd for 50967@debbugs.gnu.org; Wed, 06 Oct 2021 18:15:48 -0400 Received: by mail-lf1-f45.google.com with SMTP id y26so16580459lfa.11 for <50967@debbugs.gnu.org>; Wed, 06 Oct 2021 15:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+ahiwUOso/daffJmotov376DrPj2tG7GBXhjNRszBFQ=; b=Qak4dyhzTgcwTU9uDbUK4T/9eJ3M9/wGIg2OZO0qx89bTAmzBCp75R0BxNcfbUo7q6 pZSBIO0LhD5ZF14fgNA3LvTeYvZ+4LCThEsirSzsKYpeJNdqT/fdJHG56i6t10anmXHn xEiCEeJgwbQUgKTwQ2/FOLzX3R3AOeIZoSB0TgxCfWnXCGpgeZiNdzRKsUJ7dhgA2J2m hA7sWEvwBxSpolwRNjzkIK/4Gs3UfcFTz0G1tMkKK3UXO3B6LPP7HqXtDHU4VQocubE5 NrXSGQKVJPfysz1GAfTYdP0BQDT+4kVoKv6U/m6ugMKc3AbBtyyw5Csrzmu8ebA3z0SE Grow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=+ahiwUOso/daffJmotov376DrPj2tG7GBXhjNRszBFQ=; b=sYp7OZSUe5Y6LPR0GjvUiEw9E2L3knCPCkvmZG9i8UDkTIPugOKHCJxv7Xngu1k83z mutH3ODu1eHnm8bvVFrE7VQPc+o2vDL+qeQJOxy+7h6b61Psv79diY8yUNoLs5IOUM4Q DhvGEn36rZ0l0/Yq0/LJmF7zbYA0eW+ns4ZpcBw6yNE1ywHxx3FtEZvMF0Q3WjLSgZoJ YxVTIUw2+YNjW9GALrTGDbbqZGb2Z9+/JtX8daMZtHDDK3pBLXQ2xTdBClrKROc1Pq9o 6I93WQnce6m/Y1IGGk3Cy/m0qLqmcrqzX30riReEhY4Tqttq5jfghuS438aBUl7RMCMK 1o5A== X-Gm-Message-State: AOAM530Th9iBsGkc4XOcErF0qukeOCrwmW4ePxbog8hVE1P0R4AxjnqZ COrmE+Sfd1dr6DFPi62dHbQ= X-Google-Smtp-Source: ABdhPJyEVL00up7C8S46m2y4FYpUWcDPx2xZl30g7MqjSUJ1Ke0TNLtuyTgMb/i8kjJeobLvUioALA== X-Received: by 2002:ac2:5e31:: with SMTP id o17mr635430lfg.36.1633558541554; Wed, 06 Oct 2021 15:15:41 -0700 (PDT) Received: from guixsd ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id w11sm798246lfn.93.2021.10.06.15.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 15:15:40 -0700 (PDT) From: Oleg Pykhalov References: <87h7dwq4cb.fsf_-_@gnu.org> <20211004231331.5269-1-go.wigust@gmail.com> <20211004231331.5269-3-go.wigust@gmail.com> <878rz54xmy.fsf@gmail.com> Date: Thu, 07 Oct 2021 01:15:37 +0300 In-Reply-To: <878rz54xmy.fsf@gmail.com> (Oleg Pykhalov's message of "Thu, 07 Oct 2021 01:05:41 +0300") Message-ID: <871r4x4x6e.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633558577; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=+ahiwUOso/daffJmotov376DrPj2tG7GBXhjNRszBFQ=; b=hjW5PrrpCAEeDszLV2OfABTKJsX/SOqPEtN6HEXiw/SWuDoBzfY/H30aj3d93oAedJI5gh mZxzbCbEiAZ49dce4UAsIJxKmb4IRA47EzBioJxjOEJKHQ5vvcfsRSEL1nvOtad0Vv9VnH VUi+XfxTIcjeQ4SfrSAnLrx6LgpnyHzW4mXfPnJYYGsvDu1mrUZuH1k7/pDlYcKxX9yMTs CAsDdmPHlYopLCvZQ2TiB5al/UAx14mjIBfry4mYiprFa5wdYv3bawvEhTnf82lndz10ek TFCYwB0mr8d9/nHn/XlfUAH8YgApW6bWPIikW0CRW8m6unj1UfYFmgafSs10hQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633558577; a=rsa-sha256; cv=none; b=U2iqFZDENKVBQRfgAF3ZkWbXlQXoshbNfF6pnMNubSPAW2g3J1q0vVU1T7JaaUtXCFjQIL lWg1FividzvRp985MMbQ8G2BKpXQKgl6lqpda+rRGzpH/emk2dVWoIShH2IotPuRtyvUmQ N5Y8z22XEYeoldrFQ2EpC+NVNNWgZsyo2FO6v8kYMKA+ONvzlUAj4QoFo3MqO5b9ExGgei +bKbEhPkSZ4skwoF5GbUSUVHIacOf1BXE//Muqklvm/GwNaiXpItxL0sglmU8P2ZfBTtdB 5uwLMycBsb7IwIw4KO4F9FyNMsXlyeZneagemM5CjV6KvTXPvcfdI8c/ogD8qw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Qak4dyhz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Qak4dyhz; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 82805E3EA X-Spam-Score: -1.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: +dhobra9KPfN --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Oleg Pykhalov writes: > This patch fixes user's files corruption. Also, I applied suggestions > about commit message, thanks zimoun! Also, in addion I forget to: Replace '#!/usr/bin/env bash' with '#!/bin/bash' Maybe a /bin/sh would be more Guix friendly, but shellcheck warns about export -f does not exist in posix shell. Thoughts are welcome ;-) Remove a unnecessary subshell in run_guix_home_without_home. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-scripts-home-Make-sure-profile-directory-exists.patch Content-Transfer-Encoding: quoted-printable Content-Description: minor fixes for guix-test.sh From=206351e3f099d3c09143c5f0289216d52ee45664d9 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov 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 exist= s. * tests/guix-home.sh: New file. * Makefile.am (SH_TESTS): Add this. =2D-- Makefile.am | 1 + guix/scripts/home.scm | 2 ++ tests/guix-home.sh | 84 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 tests/guix-home.sh diff --git a/Makefile.am b/Makefile.am index b66789fa0b..5bf2567dc8 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -546,6 +546,7 @@ SH_TESTS =3D \ tests/guix-package-aliases.sh \ tests/guix-package-net.sh \ tests/guix-system.sh \ + tests/guix-home.sh \ tests/guix-archive.sh \ tests/guix-authenticate.sh \ tests/guix-environment.sh \ diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 75df6d707d..115dfadb57 100644 =2D-- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2021 Andrew Tropin ;;; Copyright =C2=A9 2021 Xinglu Chen +;;; Copyright =C2=A9 2021 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -179,6 +180,7 @@ ACTION must be one of the sub-commands that takes a hom= e environment declaration as an argument (a file name.) OPTS is the raw alist of options resulting from command-line parsing." (define (ensure-home-environment file-or-exp obj) + (ensure-profile-directory) (unless (home-environment? obj) (leave (G_ "'~a' does not return a home environment ~%") file-or-exp)) diff --git a/tests/guix-home.sh b/tests/guix-home.sh new file mode 100644 index 0000000000..b0b85737b0 =2D-- /dev/null +++ b/tests/guix-home.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +# GNU Guix --- Functional package management for GNU +# Copyright =C2=A9 2021 Oleg Pykhalov +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# +# Test the 'guix home' using the external store, if any. +# + +guix home --version + +NIX_STORE_DIR=3D"$(guile -c '(use-modules (guix config))(display %storedir= )')" +localstatedir=3D"$(guile -c '(use-modules (guix config))(display %localsta= tedir)')" +GUIX_DAEMON_SOCKET=3D"$localstatedir/guix/daemon-socket/socket" +export NIX_STORE_DIR GUIX_DAEMON_SOCKET + +# Run tests only when a "real" daemon is available. +if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connec= tion)))' +then + exit 77 +fi + +STORE_PARENT=3D"$(dirname "$NIX_STORE_DIR")" +export STORE_PARENT +if test "$STORE_PARENT" =3D "/"; then exit 77; fi + +run_guix_home_without_home() +{ + # Save current directory (Guix source directory) for later mount + test_directory=3D"$(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 + + cat > "dot-bashrc" <<'EOF' +# dot-bashrc test file for guix home +EOF + + cat > "home.scm" <<'EOF' +(use-modules (gnu home) + (gnu home-services) + (gnu home services shells) + (gnu services) + (guix gexp)) + +(home-environment + (services + (list + (service home-bash-service-type + (home-bash-configuration + (guix-defaults? #t) + (bashrc + (list + (local-file (string-append (dirname (current-filename)) + "/dot-bashrc"))))))))) +EOF + + guix home reconfigure "${test_directory}/home.scm" +} +export -f run_guix_home_without_home + +unshare --mount --map-root-user --fork sh -c "run_guix_home_without_home" =2D-=20 2.33.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFeIAkUHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+pzd+hAAuDUWd2yfNf/J3Vu7pPJv4hGGU3Lf lpsmppoch6gXCIqFGDE4rQk+mJhZQo+53HfNkj6sQYctiBGkbMCGiWvFCW7gjpTM mcThPIJqTzrD2UzBgKLoEpOHuwV6/KnZWFA//SwBIQDvHP1FRQn6PEDtK/B7uHAS yNW59D2SH2Qa6NPRhwFcCsy623GceLLwEYjvdx2F9w4UYPDEX0zezS9GqlUIghnN yUVmT/djl5r6FhXm1Ovv0vskWbGmxj2G/i38i/0oBm+4UUtfnGxCbeUOUhB0MNBz SaHbkY1wrJQ25L+Ao9K3R19iIh24UI8Ce1fUeR1LvdyVPIKQzE9J7V+Yw94scOL1 vA6LWTm6tYaz5wZdm1Ii+lUH4zNM/tPUH4MnGCsk6sxIh5QsWjXyyN7kSZZH6YpZ eQQYk91MBIvfRltou/Terqxn1Z7lUA697dC95Uo+Jh5Z2S2R0yTupe0tI2PxTZ0x 6AHQgU44OaDUMQsas3Mnl2/cYLnJ9WYNn0ncWEkCN4rbNCTy/o5T0d1CwvskGR4q E8HukErsJpIoclWpp2tDv+7/2b9tg+/T1hOw81GQT+qLDFlNkQTmWArMDcAtxCB5 OL4Ty+t3nqSrK4rQka3NAWVV+gEqprVVZXKq+5hmzFzWsANwL+r+pVtvEqO5aESt OT1sKJiRZqu1eH4= =Smsa -----END PGP SIGNATURE----- --==-=-=--