From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0LBKKp5XGmPsXgAAbAwnHQ (envelope-from ) for ; Thu, 08 Sep 2022 22:59:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OJpEKp5XGmOtWgAAauVa8A (envelope-from ) for ; Thu, 08 Sep 2022 22:59:10 +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 0B23C2C8F0 for ; Thu, 8 Sep 2022 22:59:10 +0200 (CEST) Received: from localhost ([::1]:49014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWOc9-00011J-6z for larch@yhetil.org; Thu, 08 Sep 2022 16:59:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWOc2-000114-0X for guix-patches@gnu.org; Thu, 08 Sep 2022 16:59:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWOc1-0003Hn-Np for guix-patches@gnu.org; Thu, 08 Sep 2022 16:59:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oWOc1-0006P8-Jn for guix-patches@gnu.org; Thu, 08 Sep 2022 16:59: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, 08 Sep 2022 20:59: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.166267073924611 (code B ref 56677); Thu, 08 Sep 2022 20:59:01 +0000 Received: (at 56677) by debbugs.gnu.org; 8 Sep 2022 20:58:59 +0000 Received: from localhost ([127.0.0.1]:60316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWObz-0006Os-9M for submit@debbugs.gnu.org; Thu, 08 Sep 2022 16:58:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWObx-0006Od-7k for 56677@debbugs.gnu.org; Thu, 08 Sep 2022 16:58:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWObr-0003H4-V0; Thu, 08 Sep 2022 16:58:51 -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=7PaYvG17ntKYybxNMMFaOvJPcGf3dVZsFg6q15t9Q3w=; b=d0hJzgMRxLrPne2FKVAt CPkxrZtxpn3vkCO0NXVuofh6LWiv6QVW3/Up96WXdXyEA4KKTyd3H6YbFpZxAlFWozk6UH1UFGxbW Anl6OdEbwQ0Behs+AjO8Xon0Xaf5gCXtr6aELLh0Yia3vhtCfV5PMggS6cIc0YHa64Pnf0Y6bLItM B2PD2dCMntnv5ZrSGMtDRmN2BuVx9Iuu6RCug7QEZYsktx/3KUgixUkC62e8gfl/mH9JN2srlg53g /d7shiA/KirM97PKrC7VjUbC81Mxq+m7uXun9IV3nsgyBlDPdozgrfF0TbyHRPNeN2EgnL6Icstm9 H72ak7U3aTBMdg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54950 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWObq-0005Va-RL; Thu, 08 Sep 2022 16:58:51 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <1LCXD7_zuGflSFovh_mKvhdayNcoWp8ALeguq3i2-XWwWHgzZuPak2gSBN91VLNJ84lubuFAt1dPB282Zy0pBmh_zbiI2qI-7n0LP9F03u4=@protonmail.com> <87r11wmh2h.fsf@gnu.org> Date: Thu, 08 Sep 2022 22:58:48 +0200 In-Reply-To: (John Kehayias's message of "Wed, 17 Aug 2022 21:43:08 +0000") Message-ID: <87mtb9d1mf.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=1662670750; 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=7PaYvG17ntKYybxNMMFaOvJPcGf3dVZsFg6q15t9Q3w=; b=ie9BdC3+mmcTG/vXcmbW4QbK1rMsy/6h3vsG0UbYYY1EDsTLYMeKf2jM5PatTkOvcNxpnb AOQBn3uaqs1RdUiUOKfCoz4As01lxF4uDityFNy/Du8yktcqeKeaa4Ns5a/W+IQc2YC79R qhkgN/NstpVefFTghZ4nwZCq5pU5M/S3qkaAHgcWBd+H/FqA8k3iZKBqthq+6FlwESBK2x 8vAQYhMLAAqEcDHoPpRrelMVKCRsaL9pHz34Ejs/vwhbDEeiXbDOohYA7husiKrh3u4N5a 1IYWbueWeU0CbpUXpR+jTeFxwSzJKzbzrl69fOeUbhq8Ao8FkC8aKwf0LUx3jw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662670750; a=rsa-sha256; cv=none; b=ItUfzdYQZfsEjYSwVEvJ2PSCAKeS4sr6NcnHt1Vpz+fw8ElK0wf7KuYc07gFCsg/B0Bidz ZXzcyjdRShDGRYeBlkQCJJ+Koq6FKFPo2S5SM1+UyBJqfCoscChfYKkmXzqNtDB2+LP1I6 NSDTlf6raARSi0rfoXt01l7Viw4Z+KvTw+BN5QEG+wONDjvqKOuk889Nk0816tcFPm6J7c c1iFqnYW/+cLmPu+fRwvKB6o2ybCDNgCtNFVd5g8oo/sLchxfHpU0LGu5I7ZoWvEQtiYQM Jprj5FKCo8Wp9eAjDYo3jTQt2otGjBqGBuq5XCW5JF2o5kSxm07078JoXqA+NQ== 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=d0hJzgMR; 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: -4.49 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=d0hJzgMR; 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: 0B23C2C8F0 X-Spam-Score: -4.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: Q8TDtGe/jp0G Howdy, John Kehayias skribis: >> I would prefer to keep complexity as low as possible, and thus not have >> this glibc variant. >>=20 >> Now, I don=E2=80=99t know for this use case how much it matters that lib= c honors >> /etc/ld.so.cache. Intuitively, like I wrote on guix-devel, I=E2=80=99d t= hink >> ld.so.cache doesn=E2=80=99t matter, but you encountered counterexamples. >>=20 >> 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. >>=20 > > Right, though as I said, happy to hear of alternatives or what other use = cases come up. This seems rather robust to any "usual" assumptions though. > >> It seems that =E2=80=98glibc-for-fhs=E2=80=99 is merely added to the env= ironment though, >> and not actually used? >>=20 > > Well, it is added to the environment which here means the glibc-for-fhs l= ib directory ends up in the container's global /lib. This may be useful for= anything expecting a more "typical" glibc to be found in the typical locat= ion. I can't say I know the particulars here, other than binaries and an ex= ample of other nested containers (used in non-free software, but the contai= ners are bwrap and friends) expecting glibc to default to a global ld cache= . Again, there may be other workarounds or ways to reduce this, but for now= I followed the "emulate" part of the flag :) Oh I got it; that /lib/libc.so *is* used, but only by binaries that were built on an FHS distro and that you=E2=80=99d bring in (that=E2=80=99s the = whole point, I guess). It=E2=80=99s not used by Guix packages. >> 1. Can we make the implementation more orthogonal and less entangled >> in the already-long =E2=80=98launch-environment/container=E2=80=99? >>=20 >> 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 procedure= , and >> possibly by adding a generic hook in =E2=80=98launch-environment/contain= er=E2=80=99 >> that would call said procedure. >>=20 > > Sure, this sounds like a good idea. I can certainly separate out the FHS = setup to a separate function and call it. But I'm not sure what you mean by= a "generic hook" here. Do you mean that launch-environment/container would= have as an argument say a list of functions it would call? Yes, or an argument with a single procedure to call at a specific point. That would default to a no-op. >> 2. Please add tests. You can probably augment >> =E2=80=98tests/guix-environment-container.sh=E2=80=99 for that. Let us k= now if >> you=E2=80=99re not sure how to do that. >>=20 > > Thanks, definitely forgot about that. In looking at that, I've just ran i= t with "./pre-inst-env sh tests/guix-environment-container.sh" and see that= the exit code is 0. Is that the correct way to run these? The correct way is: make check TESTS=3Dtests/guix-environment-container.sh Compared to what you wrote, it uses ./test-env (which spawns a daemon that uses the local store, not /gnu/sore) and sets a bunch of environment variables. See . > Secondly, I'm trying to think of what tests to add. I could of course run= the same tests already, but with the --emulate-fhs option, to check that t= here are no regressions. Other than that, maybe checking that e.g. there's = /etc/ld.so.cache, /lib, and so on? Right, at least you=E2=80=99d want to check for these files/directories. Note that since the test relies on =E2=80=98glibc-for-fhs=E2=80=99, it cann= ot be done the =E2=80=9Cnormal way=E2=80=9D (that is, using the local store rather tha= n /gnu/store) because it would end up building the world. The solution here is to use /gnu/store, if available, and to otherwise skip the test (return 77). See =E2=80=98tests/guix-pack-relocatable.sh=E2= =80=99 up to line 40 on how to do that. HTH! Ludo=E2=80=99.