From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 sErqENlXGmMGpwAAbAwnHQ (envelope-from ) for ; Thu, 08 Sep 2022 23:00:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QEr7ENlXGmMaJAEA9RJhRA (envelope-from ) for ; Thu, 08 Sep 2022 23:00:09 +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 06E342CAD5 for ; Thu, 8 Sep 2022 23:00:09 +0200 (CEST) Received: from localhost ([::1]:50522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWOd6-0001FF-2p for larch@yhetil.org; Thu, 08 Sep 2022 17:00:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWOd0-0001F2-N4 for guix-patches@gnu.org; Thu, 08 Sep 2022 17:00:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWOd0-0003Nn-Ck for guix-patches@gnu.org; Thu, 08 Sep 2022 17:00:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oWOd0-0006RL-8L for guix-patches@gnu.org; Thu, 08 Sep 2022 17:00:02 -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 21:00:02 +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.166267074924657 (code B ref 56677); Thu, 08 Sep 2022 21:00:02 +0000 Received: (at 56677) by debbugs.gnu.org; 8 Sep 2022 20:59:09 +0000 Received: from localhost ([127.0.0.1]:60321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWOc8-0006Pd-QN for submit@debbugs.gnu.org; Thu, 08 Sep 2022 16:59:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oWOc6-0006PE-QC for 56677@debbugs.gnu.org; Thu, 08 Sep 2022 16:59:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWOc1-0003Hj-J7; Thu, 08 Sep 2022 16:59:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=7PaYvG17ntKYybxNMMFaOvJPcGf3dVZsFg6q15t9Q3w=; b=eA+nWG+MBdCo+DV+pCwv RXQ2wSbFRJca0+kggEI/mTMqStkbktgSwHJULSgUm/+z4jfy5oJIfqaaen3szS1z83dP19O97C0La /A09omPVf0Rs8IuCbDwHk12GXZnxgrLSn5Ij4SW/tQAfS+2vVBC65ItZcyvyphc3dbWOT2iPFAtQF trHGeoEditxcJ7sLCwkgbZ3f7mESf64wh8F2OoeRcrnv4szU9DwB0GolWr7bByc23Ok2ae2QlKh+/ 00eSME1v8y+8CB+0+c5zs5pZ6YoXhajA5xdSLyvxTa53PKdnVAQM0Rk1QvDcea5mN5w9JwQMTYFqr AfaS13LEWU+Q5A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:58574 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWOc0-0005eS-Rz; Thu, 08 Sep 2022 16:59:01 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (John Kehayias's message of "Wed, 17 Aug 2022 21:43:08 +0000") References: <1LCXD7_zuGflSFovh_mKvhdayNcoWp8ALeguq3i2-XWwWHgzZuPak2gSBN91VLNJ84lubuFAt1dPB282Zy0pBmh_zbiI2qI-7n0LP9F03u4=@protonmail.com> <87r11wmh2h.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Date: Thu, 08 Sep 2022 22:58:59 +0200 Message-ID: <87leqtd1m4.fsf_-_@gnu.org> 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=1662670809; 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=CIjwiNjPEQh48Z7Qc+78+WPWtgsKYvyo13sOExFInbldohXO+htS9arycl9rsoKyY6W5T5 Gb4DT99b1vFrSt269HVyPDUP2wffcws6dGvd3ggnG+qa0BHqvCa9kCKjWveksRbChOoytO 1Uguf8NtXlPHYpt1lxL/boIKoRU1J8YGgKHCe0z43dR63e4Ee7COMPk3cyxahfH9f17DXU 7PSiuQ1X8x5H1MFlVGDNRl0UG9mHDse02QxLlJ78tN6dZX2rog0aGWFtAt/KPuVUW6deJb dePZhUKlWUs7gG516V/abj5Dmc4C+FUU6NuAAQ3VBviC+ntIHKOR2KcziJyJ/g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662670809; a=rsa-sha256; cv=none; b=SXbOnWFbY4pcXs5a06HeU6+jzz2rFnOFLQ7M6x3v3viOtqCoP2RECeejf/5BaIu1d28xvc QqA+D+zC4HQ9IkKiHxUls5DqKGynjsUFUOQjYoE5IJuO9uJ1nQi9j2TJ4En6L30DDWWjcZ olOibVJCo7HYqXGqsqqR1LOxFhSsjSrMYTTGV97WMRnlOdPmdKZbRhE4ngFbxTRUqGX1hy yKnbrT2zcYO6Kh8VN+ep3V4tBsWR/vfAfLFPGan8ZOnP8XBbZMItAbp+n4mtxd2YG2Tyey GDKNd+hxdZIefE1ebPDZLt1Z+jrKW0MpRuZPg8tVgox7gry0z0/dY5ZoC6Na1Q== 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=eA+nWG+M; 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=eA+nWG+M; 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: 06E342CAD5 X-Spam-Score: -4.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: Sd+fucQHmUbE 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.