From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 iFiLG1G/wmNfNgAAbAwnHQ (envelope-from ) for ; Sat, 14 Jan 2023 15:42:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QOpRGlG/wmM6CgAAG6o9tA (envelope-from ) for ; Sat, 14 Jan 2023 15:42:25 +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 35BED2A518 for ; Sat, 14 Jan 2023 15:42:25 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGhjR-0005nb-9r; Sat, 14 Jan 2023 09:42:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGhjP-0005nQ-3J for bug-guix@gnu.org; Sat, 14 Jan 2023 09:42:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGhjO-0007AN-RD for bug-guix@gnu.org; Sat, 14 Jan 2023 09:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGhjO-0007m5-Ba for bug-guix@gnu.org; Sat, 14 Jan 2023 09:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#60566: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 14 Jan 2023 14:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60566 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: John Kehayias Cc: jman , 60566@debbugs.gnu.org Received: via spool by 60566-submit@debbugs.gnu.org id=B60566.167370728929844 (code B ref 60566); Sat, 14 Jan 2023 14:42:02 +0000 Received: (at 60566) by debbugs.gnu.org; 14 Jan 2023 14:41:29 +0000 Received: from localhost ([127.0.0.1]:53721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhir-0007lI-9b for submit@debbugs.gnu.org; Sat, 14 Jan 2023 09:41:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhim-0007l3-Sx for 60566@debbugs.gnu.org; Sat, 14 Jan 2023 09:41:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGhih-00073n-DV; Sat, 14 Jan 2023 09:41:19 -0500 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=zr9rs4Cphn1AhrEvaqEsWVQPy3eMPbwRTt5k/4fup5c=; b=i6orZBlhr++beyJ8WonB se7/ZLEBm0FkGJEZAAdF5Nhdz71xQUIV7banNQJrF5/rqe9niXQdp5VbA6MHA+Z5DnIpVwRxlBFLr Kjuzrij/m6dEovanmGp5Y747nrJ70LOzx3xYURGRMQkrBmoPM4hMMJqKYtWNxBwU97XO8kmvsDxEH P0HiWoekipKaR0XGzDFUr8+WSRAfiJPl6UesiaRdAVj6rgJ/ae/FG1ZvQlVhs2uRVb8OZJi3UF6rL B+XxQFS9bV9BvsKxJS8zkHGAho68u8mhw1uGy1kry2AfQE535IHxrSekk2JayDZNJRooFZP4ku7SI XF0nom0bHlPYyw==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGhie-00026G-Vs; Sat, 14 Jan 2023 09:41:18 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <874jt4k7bl.fsf@protonmail.com> <874jt3xo37.fsf@gnu.org> <87zgam85yj.fsf@protonmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quintidi 25 =?UTF-8?Q?Niv=C3=B4se?= an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour du Chat 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: Sat, 14 Jan 2023 15:41:15 +0100 In-Reply-To: <87zgam85yj.fsf@protonmail.com> (John Kehayias's message of "Fri, 13 Jan 2023 21:44:59 +0000") Message-ID: <87ilh99o1g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.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: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673707345; a=rsa-sha256; cv=none; b=P4gMl4WjvZRmajGnhfNxr/AJZEZNeRidnzTEcIunlI0i/e8bFlfRt2xIORN8IS5ufdJVkA AsrSTJLle6vWmaoLt81gWxyUbtuJwAd15ie7TsBEgY7E7+cgRf586LcS1FzR1x/yH2gso3 T4JUUTkbV1s3n5FZlRLaZJ1zjWcpvJgZmEC9wN7wQ+3jP/lixolLFGzf/mTkbVa2dW3h5M QJLH/V/Otm/Xz0mrWHhRug5Xr62RDcxqib1nrR1vhWCsxYbxLeFA/bVDTXEfx1tjQU7uzV FBmvWv7/y79miAdmoghq5G6cSDzjrylR4HEUjAsrFGmtoy7T8NabJbNgfxkCgA== 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=i6orZBlh; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673707345; 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=zr9rs4Cphn1AhrEvaqEsWVQPy3eMPbwRTt5k/4fup5c=; b=Xt2GjTQBbDHOU4X9nmzH2pKSyqjbTbjChzfzRkiYjT9Tg9jrjsWhJrRKAuJb1vt97aXjLV CKXJUiy4Pzt/b35VH9D3V5a6Ya4twUZ7J9o40JjSEyehzUZSAS/lR27iNdXvWL2gE1hmjS ++UJI+hX/ZmrIJnbpAhl/IuJqWDYf/Z9Z4NPZDWVF2jBeiDRivBi8sRLVPmR/pVlpJV7aP AprSiPzOcXueEmFjWudPZuEcb9820qtL9of4mOYcAlQHb4IdPuQtbiVdgw7Sqx5KAW2ZbQ K8PG0qoXtKRY728VlLNQ7CbebuCh0IOocEtd9jDmBLWz+5/QRxRPOUifU7E85A== X-Migadu-Spam-Score: -3.01 X-Spam-Score: -3.01 X-Migadu-Queue-Id: 35BED2A518 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=i6orZBlh; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: OHjKKMXjNPJs Hi John, John Kehayias skribis: > From beb6f9255fc62fe52e237f82c7e953a21b7f82f4 Mon Sep 17 00:00:00 2001 > From: John Kehayias > Date: Thu, 5 Jan 2023 16:06:19 -0500 > Subject: [PATCH] * environment: Fix '--emulate-fhs' option overriding $PA= TH. > > Fixes where even if "--preserve=3D'^P= ATH$'" > was passed to 'guix shell' it would be replaced by just the FHS directori= es > when '--emulate-fhs' was also set. > > * gnu/scripts/environment.scm (launch-environment): Add the FHS directori= es to > $PATH rather than overriding $PATH completely. > * tests/guix-environment-container.sh: Test that FHS directories are in $= PATH > in the container and that $PATH can be preserved. [...] > - (setenv "PATH" "/bin:/usr/bin:/sbin:/usr/sbin") > + (setenv "PATH" (string-append "/bin:/usr/bin:/sbin:/usr/sbin" > + (when (getenv "PATH") > + (string-append ":" (getenv "P= ATH"))))) Remember that =E2=80=98when=E2=80=99 returns *unspecified* when the conditi= on is false, so you=E2=80=99d get a type error here when PATH is undefined. Instead write: (if (getenv "PATH") =E2=80=A6 ""). > +# Test that $PATH inside the container has FHS directories. > +guix shell -CF --bootstrap guile-bootstrap \ > + -- guile -c '(exit (if (string-contains (getenv "PATH") > + "/bin:/usr/bin:/sbin:/usr/sbin") > + 0 > + 1))' Even (exit (string=3D? (getenv "PATH") "/bin:/usr/bin:/sbin:/usr/sbin")). > +# Make sure '--preserve' is honored for $PATH, which the '--emulate-fhs' > +# option will modify. We can't (easily) check the whole $PATH as it will > +# differ inside and outside the container, so just check for an added st= ring. > +PATH=3Dthis-is-a-test:$PATH guix shell -CF --bootstrap guile-bootstrap -= E PATH \ > + -- guile -c '(exit (if (string-contains (getenv "PATH") > + "this-is-a-test") > + 0 > + 1))' It might be slightly more concise with =E2=80=98env=E2=80=99: PATH=3D/foo $(type -P guix) shell -E ^PATH$ -C coreutils -- env |grep ^PA= TH=3D.*:/foo (I think =E2=80=98--bootstrap=E2=80=99 doesn=E2=80=99t buy us much here bec= ause we have to download/build =E2=80=98glibc-for-fhs=E2=80=99 anyway. =E2=80=98--bootstra= p=E2=80=99 and =E2=80=98guile-bootstrap=E2=80=99 are particularly useful for testse that c= an run without network access and without building tons of stuff, as in =E2=80=98tests/guix-environment.sh=E2=80=99 for instance.) Otherwise LGTM, thanks! Ludo=E2=80=99.