From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uOHOMoCh62JyzAAAbAwnHQ (envelope-from ) for ; Thu, 04 Aug 2022 12:37:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id oAS7MYCh62IX5AAAG6o9tA (envelope-from ) for ; Thu, 04 Aug 2022 12:37:52 +0200 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 69B552DC31 for ; Thu, 4 Aug 2022 12:37:52 +0200 (CEST) Received: from localhost ([::1]:43242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJYEg-0002Jy-R6 for larch@yhetil.org; Thu, 04 Aug 2022 06:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJYDu-0002Jm-Am for guix-patches@gnu.org; Thu, 04 Aug 2022 06:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oJYDu-0008HS-2b for guix-patches@gnu.org; Thu, 04 Aug 2022 06:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oJYDt-0000nY-VI for guix-patches@gnu.org; Thu, 04 Aug 2022 06:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56677] [PATCH 0/2] environment: Add --emulate-fhs option. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Aug 2022 10:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56677 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: John Kehayias Cc: 56677@debbugs.gnu.org Received: via spool by 56677-submit@debbugs.gnu.org id=B56677.16596093813002 (code B ref 56677); Thu, 04 Aug 2022 10:37:01 +0000 Received: (at 56677) by debbugs.gnu.org; 4 Aug 2022 10:36:21 +0000 Received: from localhost ([127.0.0.1]:51391 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJYDE-0000mM-UJ for submit@debbugs.gnu.org; Thu, 04 Aug 2022 06:36:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oJYDC-0000m9-QC for 56677@debbugs.gnu.org; Thu, 04 Aug 2022 06:36:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJYD7-00088R-CI; Thu, 04 Aug 2022 06:36:13 -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=C+WgOcb4r6xAgmaUsHSru0Xqhk0cX35jCcg4/ZBn1I0=; b=rlq/0nv+vCJJGicgONZu zVnpltriZ2msN8ZtEA55q3jZxgP4kophu6Z+V1tA0ARcPVWnCKGBKEGUoKyw5VJ0Z6H+rBU1kcj6H z/dK6ZZA6F6b6l9klUMaKRo/4HuxfEVH9NvSbmFOzC9Rf/S6uNUg+0yESfcPHCF42IBbBZZZdS1ie WzrB+mX0Likx+BwmbpaZ92uwVFRoZCX9zRrFbuN57X3CTF6h6WJm7rX1n+VuhsSVchzk6J//YUx7b 9lo4MaKqXufFTk2q97Lb3XugpSiXzy+GVPUNf5U4jq9FIr5QIU7zKI4ka7g74lnnJiFyQk6+NcwAu L0DQ6rdEoyqWOQ==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=52982 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJYD2-0004Eq-Gb; Thu, 04 Aug 2022 06:36:11 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <1LCXD7_zuGflSFovh_mKvhdayNcoWp8ALeguq3i2-XWwWHgzZuPak2gSBN91VLNJ84lubuFAt1dPB282Zy0pBmh_zbiI2qI-7n0LP9F03u4=@protonmail.com> Date: Thu, 04 Aug 2022 12:36:06 +0200 In-Reply-To: <1LCXD7_zuGflSFovh_mKvhdayNcoWp8ALeguq3i2-XWwWHgzZuPak2gSBN91VLNJ84lubuFAt1dPB282Zy0pBmh_zbiI2qI-7n0LP9F03u4=@protonmail.com> (John Kehayias's message of "Thu, 21 Jul 2022 04:14:19 +0000") Message-ID: <87r11wmh2h.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (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=1659609472; 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=C+WgOcb4r6xAgmaUsHSru0Xqhk0cX35jCcg4/ZBn1I0=; b=INp4/pU1pv9TmjxWpMpf4s3wvvz2tOrwvRzM/MqGiwa+j+pIS64pCAdHlVBejAC0tCTUNB TYF2eScPWJV1qn61wJ0PiiDSq8Y5SNoGgtskaHgdhcJuWS60rpbLUfHLF9GyG6oprqy/bs RTj/ugXHHy0rEQ2zGnONvfZdQFbfYrY6IZUQabnm36xc6+nQejwnsmPHr2JtBZ0Id1DBtZ le0Ogbn3wPFnsGSfFVoh4BFroLFHYEARYAukAKPk1gXnyyOyw2EtqvOq6IBKMUp7Li+iDg 5krUluo4PWQRHKeaWoQ4VtF09+2/WHTir/Z/ngBBlR95rj8aU8n9xihhB5mT5Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659609472; a=rsa-sha256; cv=none; b=N9cBJaILZpJ6CloK85wNW9/7Uv1EYOcUG9i6Mbp43k/sk8rtgwoRk4FTZ0x3Iqiyp3XIpC u/ToSr3iCeKqDPscoPVFEQessJReLK7WkMn3qQOT+n4HILz1D0XKh3hVpNl5lVgpAxW2Hl oByyqPiGn5rFtm5p1xOWBSrCshjD4ga4oyCI06vpQrEPoULj20gMH8JP0wlzWFvFnXAslN rnvsWwvxzEu0Q2TNM9jxvOpOxzjT7WnnCGzQvy8Kw3kDX79BCMjov9kJBABn9/vhhOiUHM FACB0AZXMK6YTAQrr6a6AyIO1qmyryYMuv9upOGud7oO2wWhfIpBeWYPY02XuA== 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="rlq/0nv+"; 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: -2.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="rlq/0nv+"; 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: 69B552DC31 X-Spam-Score: -2.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: ibdECyrA5RBf Hello, John Kehayias skribis: > 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 opt= ion for environments. Wo0t! > 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 pie= ce of making this FHS option work, but open to discussion or if it should b= e a further option. I would prefer to keep complexity as low as possible, and thus not have this glibc variant. Now, I don=E2=80=99t know for this use case how much it matters that libc h= onors /etc/ld.so.cache. Intuitively, like I wrote on guix-devel, I=E2=80=99d thi= nk ld.so.cache doesn=E2=80=99t matter, but you encountered counterexamples. So I guess that if in practice presence of /etc/ld.so.cache *and* having glibc honor it is necessary often enough, we can do that. It seems that =E2=80=98glibc-for-fhs=E2=80=99 is merely added to the enviro= nment though, and not actually used? + ;; For an FHS-container, add the + ;; (hidden) package glibc-for-fhs wh= ich + ;; uses the global cache at + ;; /etc/ld.so.cache. + (if emulate-fhs? + (alist-cons 'expression + '(ad-hoc-package + "(@@ (gnu packages= base) glibc-for-fhs)") + opts) + opts))) Or rather it=E2=80=99s only used when running =E2=80=98ldconfig=E2=80=99, r= ight? > 2. Right now I used a script written to the containers /tmp/fhs.sh to gen= erate the ld cache, supplement $PATH (somewhat optional, but I found useful= for less tinkering), and finally launch the given command or shell. I foun= d 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 b= etter 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 we= ll, 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 involve= d, 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! =20 At first sight, I find it pretty cool! I would have two grievances: 1. Can we make the implementation more orthogonal and less entangled in the already-long =E2=80=98launch-environment/container=E2=80=99? Maybe that can be accomplished by moving all the code conditional on =E2=80=98emulate-fhs?=E2=80=99 out of the way in a separate procedu= re, and possibly by adding a generic hook in =E2=80=98launch-environment/conta= iner=E2=80=99 that would call said procedure. 2. Please add tests. You can probably augment =E2=80=98tests/guix-environment-container.sh=E2=80=99 for that. Let u= s know if you=E2=80=99re not sure how to do that. Thanks for all the work, and sorry for the delay: it seems to be summer time for many of us. :-) Ludo=E2=80=99.