From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 06 18:04:02 2023 Received: (at 60566) by debbugs.gnu.org; 6 Jan 2023 23:04:02 +0000 Received: from localhost ([127.0.0.1]:56048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDvkn-0006hf-SQ for submit@debbugs.gnu.org; Fri, 06 Jan 2023 18:04:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57572) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDvkl-0006hL-KM for 60566@debbugs.gnu.org; Fri, 06 Jan 2023 18:04:00 -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 1pDvkW-0001w1-2W; Fri, 06 Jan 2023 18:03:52 -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=Ih1dqGmCL/GWNkSg4Tj0OT8eJuVAh8eI2XlQDhGRCeg=; b=VviPdHV2QaKP1QyyC4tR pH1mJEtLHzoEPIIgPPnJo6abFHcTetaT06fFbOUpx6ru/d9nwCyh6mhiptJc0WbQ5n9iF4NyP3G/a Iu2qjol3ykFuv29nwrudZo5v3D2mMHoe7L0+ZmgqSlUalXinSoim9I3gX9B5jU1YXZdLcI8YpdMIQ ABsasHw55RfgYe/M3Qmi4Trt+Xj1sUEYmOmCXUd8ViUoVb+7CAtzHE+XABG5m/uMS+nTuOU2RUKiH LNKgLm9sqpM+RM9PZVS+0O0fc0hzRoB62I2THR5/Z/EGqet9hnYs6bUt4Tt4qUrMzwTjCfYk/gohg 3CpcMjU1GlCdDQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDvkV-0006xa-HB; Fri, 06 Jan 2023 18:03:43 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: John Kehayias Subject: Re: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. References: <874jt4k7bl.fsf@protonmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Octidi 18 =?utf-8?Q?Niv=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour de la Pierre =?utf-8?Q?=C3=A0?= chaux 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, 07 Jan 2023 00:03:40 +0100 In-Reply-To: <874jt4k7bl.fsf@protonmail.com> (John Kehayias's message of "Thu, 05 Jan 2023 21:19:48 +0000") Message-ID: <874jt3xo37.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60566 Cc: jman , 60566@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, John Kehayias skribis: > From 57cdc3a8f9c6451aaf17f1fafae0bcf29faeea03 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. > --- > guix/scripts/environment.scm | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm > index c7fd8fd340..20fa5850c4 100644 > --- a/guix/scripts/environment.scm > +++ b/guix/scripts/environment.scm > @@ -475,10 +475,11 @@ (define* (launch-environment command profile manife= st > (catch 'system-error > (lambda () > (when emulate-fhs? > - ;; When running in a container with EMULATE-FHS?, override $P= ATH > + ;; When running in a container with EMULATE-FHS?, augment $PA= TH > ;; (optional, but to better match FHS expectations), and gene= rate > ;; /etc/ld.so.cache. > - (setenv "PATH" "/bin:/usr/bin:/sbin:/usr/sbin") > + (setenv "PATH" (string-append "/bin:/usr/bin:/sbin:/usr/sbin:" > + (getenv "PATH"))) To be safe, you need to account for (getenv "PATH") returning #f, and not add a trailing colon in that case. Other than that, I agree this is a valid change because that would be consistent with: --8<---------------cut here---------------start------------->8--- $ PATH=3D/foo $(type -P guix) shell -E ^PATH$ -C coreutils -- env |grep ^PA= TH PATH=3D/gnu/store/pfl0lyqbs557khv7rw90bzp24qp2lqsn-profile/bin:/foo --8<---------------cut here---------------end--------------->8--- Perhaps you can add a line to test it in =E2=80=98tests/guix-environment-container.sh=E2=80=99? Thanks, Ludo=E2=80=99.