From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2IY2FeeLNGKAfwEAgWs5BA (envelope-from ) for ; Fri, 18 Mar 2022 14:40:55 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sRqXEueLNGLd8AAA9RJhRA (envelope-from ) for ; Fri, 18 Mar 2022 14:40:55 +0100 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 B51A338F73 for ; Fri, 18 Mar 2022 14:40:51 +0100 (CET) Received: from localhost ([::1]:37676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVCqY-0003ez-HC for larch@yhetil.org; Fri, 18 Mar 2022 09:40:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVCcE-0003p4-Da for guix-patches@gnu.org; Fri, 18 Mar 2022 09:26:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nVCcE-0002jZ-5S for guix-patches@gnu.org; Fri, 18 Mar 2022 09:26:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nVCcE-0002Xs-1x for guix-patches@gnu.org; Fri, 18 Mar 2022 09:26:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54377] [PATCH 3/3] guix home: Add 'container' command. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Mar 2022 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54377 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Andrew Tropin Cc: 54377@debbugs.gnu.org Received: via spool by 54377-submit@debbugs.gnu.org id=B54377.16476099409753 (code B ref 54377); Fri, 18 Mar 2022 13:26:02 +0000 Received: (at 54377) by debbugs.gnu.org; 18 Mar 2022 13:25:40 +0000 Received: from localhost ([127.0.0.1]:56527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVCbs-0002XF-5I for submit@debbugs.gnu.org; Fri, 18 Mar 2022 09:25:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:41194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nVCbr-0002X1-BH for 54377@debbugs.gnu.org; Fri, 18 Mar 2022 09:25:39 -0400 Received: from [2001:470:142:3::e] (port=48540 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVCbl-0002hC-RS; Fri, 18 Mar 2022 09:25:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=+kA91HOoBpLLKQ0o82TOSeH2O6873DuoEt8VB2A51S8=; b=MQBtsyRTEfQD1VS5l+w3 pQn6Y8KYNfOA227+C+jOFOn826SqybKbCelE3xNrUBQEb9gvZ4BwMH9UGBwmf5WzxtxN20CnGzPs2 BY7zxQTc8CjSte0j0I5yGIYIwfO7YXWIKaEZxCbgR/aRndqIaz5EMDTz0Bh3z/5415wUqgZmU7axS oo68ZwGUlIF4NZwq8V7MnhN3dsFJS3C3iNPq2vewf9sJgZ58zv9wxu1v8JwXUnExkxRPD/7ewcPBu Aa1+7Z6AOXHuAD+2+i4FO9MwwiMQlcn/O6vrq02lAAeu9Z5E1ypE7A48gSXuGcY5dCwttNSxCuB0+ lZm3Reit7HFFmQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:51978 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVCbg-0001rW-Um; Fri, 18 Mar 2022 09:25:30 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220313215454.9576-1-ludo@gnu.org> <20220313215454.9576-3-ludo@gnu.org> <87y219hzau.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 =?UTF-8?Q?Vent=C3=B4se?= an 230 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Fri, 18 Mar 2022 14:25:26 +0100 In-Reply-To: <87y219hzau.fsf@trop.in> (Andrew Tropin's message of "Thu, 17 Mar 2022 09:24:09 +0300") Message-ID: <87v8wbqto9.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1647610855; 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: content-transfer-encoding:content-transfer-encoding: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=+kA91HOoBpLLKQ0o82TOSeH2O6873DuoEt8VB2A51S8=; b=iO6hDjdxIR9L4l0S5/Pe31sCiRCoNztqLw1mkvijLNFuI7VmvlPFowAIhx/mavVdihM5Y2 wf9BSnZiVupCTEvDznQ3CAQxqxRN3OlqTOORVKZvLqcOTRsbzuxCOA9qRDrLTnp49p4MDP 2YKteYVHO02XDaCe6dAUb1unazUW+w9Y4GuIHl2Adsogpq+QgQ3dN1DSNVo798loe6XggP YVnYTAMwKN2Z7WD9cP80WifoPpwuzCNcW6m8EjrauvGHI8/vEX5Befk17Vt6vds0ef5iVt 9w62yBhbroS7mjjtxX0u57PBbRVuh1fZQL8FKd+Am6NSzAogKMJQXvymb9mdfg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1647610855; a=rsa-sha256; cv=none; b=NXZJw/ZeH9WUp5DV/JZppIQgv7tRi7lilY0qa80RqZ2NX+8QHuBX0xFAtWphJewUI5U81V PuwT4Dke/O4Z0LIeIsNoUCLplZ3NTlWom2R1gpbgtu0xAD3YfqRj10uFaPKHqVOWZ4aqrR NU3dmuhdUoihzARWaTf0wvWFxwIbBarQVPApE2WS4CqVfE2JaL1ASpHyct8w2eck55hKyl qmz6gTpQhQ/d+rDc8N47KuAzdHlqWPbEXCItQRG1BG2wiShlJqdzVBnUv+R+UwwQZHB+FM x77iw+LG6/dX0rG4VfXu2nWkEfnNmGtc1aIRNvBIUkVhUjdCN53kKqhW44yDlQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=MQBtsyRT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.74 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=MQBtsyRT; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B51A338F73 X-Spam-Score: -3.74 X-Migadu-Scanner: scn0.migadu.com X-TUID: OmKCkJNNgp4e Hi Andrew, Andrew Tropin skribis: >> +For example, this is how you would start an interactive shell in a > > s/interactive/login ? > > or interactive login shell Yeah. I thought that as a user, what matters is that it=E2=80=99s interact= ive; the fact that it=E2=80=99s a =E2=80=9Clogin shell=E2=80=9D is more of an im= plementation detail, and too few people understand what that means anyway. :-) [...] >> +Additionally, you can run a command in that container, instead of >> +spawning an interactive shell. For instance, here is how you would > > In fact the sentence is correct, but gives a feeling that the shell > won't be executed at all. Don't know if we need to change it somehow. I agree that the sentence is an approximation of how it does things, but hopefully it gives a good idea of what it. >> + (display (G_ " >> + -N, --network allow containers to access the network")) > > Is plural form intended? (Copied from environment.scm.) I think it=E2=80=99s grammatically OK. >> +(define (user-shell) >> + (match (and=3D> (or (getenv "SHELL") > > Be aware that in some cases $SHELL can differ from the value in > /etc/passwd. For example I set SHELL to the full path to zsh and all > interactive non-login shells are zsh for me, but my login shell is bash. Agreed, that=E2=80=99s why I thought $SHELL should take precedence. (I used =E2=80=9CSHELL=3Dzsh guix home container =E2=80=A6=E2=80=9D and similar to = test other shells.) >> + (passwd:shell (getpwuid (getuid)))) >> + basename) >> + ("zsh" (file-append zsh "/bin/zsh")) >> + ("fish" (file-append fish "/bin/fish")) >> + ("gash" (file-append gash "/bin/gash")) >> + (_ (file-append bash "/bin/bash")))) > > Why we use hardcoded shell packages? For reproducibility. Initially I thought about using the actual $SHELL (as long as it=E2=80=99s = in the store). However, that would make =E2=80=98guix home container=E2=80=99= stateful: it=E2=80=99d provide different results depending on the environment. I thought we=E2=80=99d rather avoid that. > 1. The will be built in case user use a zsh-patched for example. That=E2=80=99s the downside, yes. I don=E2=80=99t have a good answer to that. I guess I value reproducibility more than customization in this case. Perhaps we could eventually add a =E2=80=98--shell=E2=80=99 option or simil= ar if that helps, though. WDYT? >> + (when term >> + ;; Preserve TERM for proper interactive use. >> + (setenv "TERM" term)) > > Just a note: the shell can missbehave if terminfo files for current TERM > isn't present in the container (for example terminal package was removed > from home profile). Idk how to properly cover this, but just letting > you know. We can use TERM=3Ddumb, but I'm not sure if it worth it. Good point. In my tests preserving TERM was good enough for Bash/Readline, Zsh, and less (all from an xterm). I suppose problems could happen with fancy curses apps and the like. > Very cool feature! Looking forward to add it to my workflow.=20 Glad you like it! It makes it easier to test new features or services, much like using =E2=80=98guix system vm=E2=80=99 when testing Guix System c= hanges. Thanks for taking the time to review! Ludo=E2=80=99.