From patchwork Thu Jul 21 04:14:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kehayias X-Patchwork-Id: 268 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 26D4327BBEA; Thu, 21 Jul 2022 05:15:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 44C8727BBE9 for ; Thu, 21 Jul 2022 05:15:13 +0100 (BST) Received: from localhost ([::1]:37296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oENai-0006FE-BB for patchwork@mira.cbaines.net; Thu, 21 Jul 2022 00:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oENaY-0006F5-F0 for guix-patches@gnu.org; Thu, 21 Jul 2022 00:15:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oENaY-0001Wn-6S for guix-patches@gnu.org; Thu, 21 Jul 2022 00:15:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oENaY-00012Q-1g for guix-patches@gnu.org; Thu, 21 Jul 2022 00:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56677] [PATCH 0/2] environment: Add --emulate-fhs option. Resent-From: John Kehayias Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Jul 2022 04:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56677 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56677@debbugs.gnu.org X-Debbugs-Original-To: Guix-patches Received: via spool by submit@debbugs.gnu.org id=B.16583768763932 (code B ref -1); Thu, 21 Jul 2022 04:15:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jul 2022 04:14:36 +0000 Received: from localhost ([127.0.0.1]:36404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oENa8-00011L-Dk for submit@debbugs.gnu.org; Thu, 21 Jul 2022 00:14:36 -0400 Received: from lists.gnu.org ([209.51.188.17]:52832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oENa6-00011D-Er for submit@debbugs.gnu.org; Thu, 21 Jul 2022 00:14:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oENa6-0006D0-AD for guix-patches@gnu.org; Thu, 21 Jul 2022 00:14:34 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:13388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oENa3-0001S4-LW for guix-patches@gnu.org; Thu, 21 Jul 2022 00:14:33 -0400 Date: Thu, 21 Jul 2022 04:14:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1658376868; x=1658636068; bh=Xs4uyOutqrJ8ToLIt26kAmXDdRKT8SHnp0Ii2hnlks4=; h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc: Date:Subject:Reply-To:Feedback-ID:Message-ID; b=bAbYX2ZW6+vQpjQswgRlmSR/Wf/qWnVxraUJFwO8pNLunJyo6UE6L51zHSJBtfVrX d3l8o72IkAw6Zx/Hf97UVykKunXpWSRfhhPrJQ0hRgZybWXO6k1H4j8XT4cj8adHg4 NctNfpsHnz55sVPsXMbl7RfHlkV4E/ee1YMVzdcxGGVweYil5wZnbC4z58TITkEOe3 QRiTPIF6ywwpw/eKcUM/Rtfkx0aSj3abt+66ofJb9149fKqUJZwkO4nOluPgPwyQot gQIaTeH0WRWbsSc3YlGX3e59FyywI8mkNxRFqufWeYzdItHiOEIuM84VmIdny3YxNz zEy2uiDeH7IeA== Message-ID: <1LCXD7_zuGflSFovh_mKvhdayNcoWp8ALeguq3i2-XWwWHgzZuPak2gSBN91VLNJ84lubuFAt1dPB282Zy0pBmh_zbiI2qI-7n0LP9F03u4=@protonmail.com> Feedback-ID: 7805494:user:proton MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.40.134; envelope-from=john.kehayias@protonmail.com; helo=mail-40134.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: John Kehayias X-ACL-Warn: , John Kehayias via Guix-patches X-Patchwork-Original-From: John Kehayias via Guix-patches via From: John Kehayias X-getmail-retrieved-from-mailbox: Patches Hello Guix, As discussed on guix-devel here (please see for more detailed discussion and design aims): https://lists.gnu.org/r/guix-devel/2022-07/msg00161.html this is a patch to add an FHS (Filesystem Hierarchy Standard) emulation option for environments. The overall goal is to mimic typical GNU/Linux distributions in following FHS (/bin, /etc, and /usr in particular) as well as a glibc that reads a global /etc/ld.so.cache and PATH with /bin, and so on. The idea is that following instructions for setting up a development environment, building software, running something, and so on in "typical" Linux environments, should "just work" with 'guix shell --container --emulate-fhs ...', provided the right inputs and other options are set. For testers, this can be used by using pre-inst-env (outside of the pure shell used to build a local guix) to run guix shell with this patch. Please see the mailing list discussion for particular examples as well. For review, in particular: 1. On the mailing list there was discussion about the necessity or not of glibc-for-fhs (added in the first patch). I find this useful and a big piece of making this FHS option work, but open to discussion or if it should be a further option. 2. Right now I used a script written to the containers /tmp/fhs.sh to generate the ld cache, supplement $PATH (somewhat optional, but I found useful for less tinkering), and finally launch the given command or shell. I found that when not providing a command the prompt for /bin/sh is not the same as when not using --emulate-fhs. So I'm not sure if this is the correct way to launch the default /bin/sh if no command is given. Open to ideas of a better way to implement these actions for a container start up as well. 3. This is my first time touching a guix script and the documentation, so please do check the commit message and guix.texi. 4. I decided to link the second level FHS directories, like /usr/bin, as well as optional ones like /lib64 (or /lib32), to the top level /bin, /lib, and so on. These could just be bind mounted to profile/bin and so on as well, but again tried to mimic an FHS distribution like Arch where the files only live in one place. While perhaps making the code a little more involved, I hope this makes the container look tidier. I may be forgetting other elements in the implementation decisions I made, but I have been testing these patches along the way and have gotten good usage of them. Please test further too! Thanks, John