From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 04 23:33:49 2023 Received: (at submit) by debbugs.gnu.org; 5 Jan 2023 04:33:49 +0000 Received: from localhost ([127.0.0.1]:49996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDHwq-0002Cw-9C for submit@debbugs.gnu.org; Wed, 04 Jan 2023 23:33:49 -0500 Received: from lists.gnu.org ([209.51.188.17]:40310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDCcE-0007Mc-GY for submit@debbugs.gnu.org; Wed, 04 Jan 2023 17:52:10 -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 1pDCcE-0001Lu-8h for bug-guix@gnu.org; Wed, 04 Jan 2023 17:52:10 -0500 Received: from mail.city17.xyz ([45.91.101.53]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDCcC-0000Ef-74 for bug-guix@gnu.org; Wed, 04 Jan 2023 17:52:10 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 298D74E05F for ; Wed, 4 Jan 2023 23:52:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=city17.xyz; s=dkim; t=1672872722; h=from:subject:date:message-id:to:mime-version:content-type; bh=dIf55jfkBp9+wwqnwBkIMdBztGhteQHZijumoKElApI=; b=S0MQiJ0qVhLl1Neulo8hAqyuq+aWiOJ3Mbgb6Ql74lSO+ngYcdE8IA+Uatczy/0c/j8VSp EYJSLL2ECwfcwcsKinO2rmMSk36d2nuLMOM9ai/5AkyWnhPetm/CrbOC3H+FRDTnWG0Lc9 9ficiGBuP2Ajhx0JHS6/5dFmE2Np0NV+zQ03M6BslxSUL1nlbtjBnigwsoGVtVWE2Bdbu0 F1h2f402XkAJax0glh/BN0tnxud/ycis0JoEvYLpF0YZf5K7rfIFoFyyMgRxFy5hxPZIOc 6+XD7DLW2bOz3thZaiuv6ZXOmALWv8X0DC1dCxSQdKkUI5c1RJQjwqoMmuLKEA== User-agent: mu4e 1.6.10; emacs 28.2 From: jman To: bug-guix@gnu.org Subject: guix container with FHS emulation and env vars Date: Wed, 04 Jan 2023 23:33:23 +0100 Message-ID: <875ydl29rj.fsf@city17.xyz> MIME-Version: 1.0 Content-Type: text/plain X-Last-TLS-Session-Version: TLSv1.3 Received-SPF: pass client-ip=45.91.101.53; envelope-from=jman@city17.xyz; helo=mail.city17.xyz X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.5, FROM_SUSPICIOUS_NTLD_FP=1.999, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_PDS_OTHER_BAD_TLD=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 04 Jan 2023 23:33:47 -0500 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: -2.4 (--) Hello, When emulating a FHS I observe that env vars seems to be not preserved. Example, the following command will not preserve $PATH: guix shell --container --emulate-fhs --preserve='^PATH$' When creating a container *without* emulating a FHS, env vars are available, example: guix shell --container --preserve='^PATH$' Pastebin log of a sample of this behaviour: https://paste.sr.ht/~jman/65e7f96c445504e11f55595b237280e0c1e3ad34 ref: https://lists.gnu.org/archive/html/help-guix/2023-01/msg00002.html Thanks for an opinion on this From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 05 16:20:07 2023 Received: (at 60566) by debbugs.gnu.org; 5 Jan 2023 21:20:07 +0000 Received: from localhost ([127.0.0.1]:53119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDXeh-0007i9-2G for submit@debbugs.gnu.org; Thu, 05 Jan 2023 16:20:07 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]:34693) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDXef-0007hZ-Er for 60566@debbugs.gnu.org; Thu, 05 Jan 2023 16:20:06 -0500 Date: Thu, 05 Jan 2023 21:19:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1672953599; x=1673212799; bh=2AWHj3SpL/+f9uEnCZyykpXGb1qEUbH3jCKLQdfOpWw=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=d49KsW+xJMf3e5vmU0G9jPjdnyrhL+fyrvj12skRhvJZ0v/Rq1rWQJe3X2F+ymW7s MaVMsX4q4nkM/alajaMv4sMbnz9rORW7JJHgSMGD8TGcfhFeKhRYsy3cE5v4csuVvI lsZin3zT6u0YhdGHTGkqqwOtSz3x6j8mCU5nK9rslOa0OSdnfoKlXtBr3ytPnD0aMK SVNnWNh7OiX1FT6MMRyq2MQn4uLIr6L2R1J03QF/WTMuFlFTkwPwf8CTiaYmUX1o6g VeBmN8kB8OW/AHBPJwf82tkTbDuBwBT//1A3AAusoxarsV2mAbLW6NKktzYhr1CNgQ a+eMQf3nX1QTQ== To: jman From: John Kehayias Subject: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. Message-ID: <874jt4k7bl.fsf@protonmail.com> Feedback-ID: 7805494:user:proton MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_RV1TpXWIsrsgjcgv85zInVOorKVVwMQXqcBXwKv49Y" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60566 Cc: =?utf-8?Q?Ludovic_Court=C3=A8s?= , 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: -1.0 (-) This is a multi-part message in MIME format. --b1_RV1TpXWIsrsgjcgv85zInVOorKVVwMQXqcBXwKv49Y Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, Jan 04, 2023 at 11:33 PM, jman wrote: > Hello, > > When emulating a FHS I observe that env vars seems to be not preserved. E= xample, > the following command will not preserve $PATH: > > guix shell --container --emulate-fhs --preserve=3D'^PATH$' > > When creating a container *without* emulating a FHS, env vars are availab= le, > example: > > guix shell --container --preserve=3D'^PATH$' > > Pastebin log of a sample of this behaviour: > https://paste.sr.ht/~jman/65e7f96c445504e11f55595b237280e0c1e3ad34 > > ref: https://lists.gnu.org/archive/html/help-guix/2023-01/msg00002.html > > Thanks for an opinion on this Thanks for reporting, I can confirm this behavior. Here is a patch for this where the FHS directories are added to the current value of $PATH. I believe this should in general be fine since this is the last step before actually calling the command given to 'guix shell' and thus $PATH has been set or preserved as needed already. CC'ing Ludo as most familiar with this code. Anything we should be aware of here? This change to $PATH in the first place wasn't strictly needed ('guix shell' already has the profile bin directory) but I thought made sense to make it look most like FHS. Thanks! John --b1_RV1TpXWIsrsgjcgv85zInVOorKVVwMQXqcBXwKv49Y Content-Type: text/x-patch; name=0001-environment-Fix-emulate-fhs-option-overriding-PATH.patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=0001-environment-Fix-emulate-fhs-option-overriding-PATH.patch RnJvbSA1N2NkYzNhOGY5YzY0NTFhYWYxN2YxZmFmYWUwYmNmMjlmYW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1lbnQuc2NtDQpAQCAtNDc1LDEw ICs0NzUsMTEgQEAgKGRlZmluZSogKGxhdW5jaC1lbnZpcm9ubWVudCBjb21tYW5kIHByb2ZpbGUg bWFuaWZlc3QNCiAgICAgIChjYXRjaCAnc3lzdGVtLWVycm9yDQogICAgICAgIChsYW1iZGEgKCkN CiAgICAgICAgICAod2hlbiBlbXVsYXRlLWZocz8NCi0gICAgICAgICAgIDs7IFdoZW4gcnVubmlu ZyBpbiBhIGNvbnRhaW5lciB3aXRoIEVNVUxBVEUtRkhTPywgb3ZlcnJpZGUgJFBBVEgNCisgICAg ICAgICAgIDs7IFdoZW4gcnVubmluZyBpbiBhIGNvbnRhaW5lciB3aXRoIEVNVUxBVEUtRkhTPywg YXVnbWVudCAkUEFUSA0KICAgICAgICAgICAgOzsgKG9wdGlvbmFsLCBidXQgdG8gYmV0dGVyIG1h dGNoIEZIUyBleHBlY3RhdGlvbnMpLCBhbmQgZ2VuZXJhdGUNCiAgICAgICAgICAgIDs7IC9ldGMv bGQuc28uY2FjaGUuDQotICAgICAgICAgICAoc2V0ZW52ICJQQVRIIiAiL2JpbjovdXNyL2Jpbjov c2JpbjovdXNyL3NiaW4iKQ0KKyAgICAgICAgICAgKHNldGVudiAiUEFUSCIgKHN0cmluZy1hcHBl bmQgIi9iaW46L3Vzci9iaW46L3NiaW46L3Vzci9zYmluOiINCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIChnZXRlbnYgIlBBVEgiKSkpDQogICAgICAgICAgICAoaW52 b2tlICJsZGNvbmZpZyIgIi1YIikpDQogICAgICAgICAgKGFwcGx5IGV4ZWNscCBwcm9ncmFtIHBy b2dyYW0gYXJncykpDQogICAgICAgIChsYW1iZGEgXw0KLS0gDQoyLjM4LjENCg0K --b1_RV1TpXWIsrsgjcgv85zInVOorKVVwMQXqcBXwKv49Y-- 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. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 16:45:23 2023 Received: (at 60566) by debbugs.gnu.org; 13 Jan 2023 21:45:23 +0000 Received: from localhost ([127.0.0.1]:52580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGRrX-0005eS-9w for submit@debbugs.gnu.org; Fri, 13 Jan 2023 16:45:23 -0500 Received: from mail-40133.protonmail.ch ([185.70.40.133]:62559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGRrV-0005eC-70 for 60566@debbugs.gnu.org; Fri, 13 Jan 2023 16:45:21 -0500 Date: Fri, 13 Jan 2023 21:44:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1673646314; x=1673905514; bh=36RuUftznrl5yzkIXXFvebS3QcsxHx+tnNp30Z0G5Bk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=txFd3Ebe/BJKytDMN/fUzabpTrFMcjkODpnx1hidNpvAuYbzYxlboVrsImQ2JeKRz 7dTvWepDXC8b4IdelU2zpr+ZDbUM6ZNRchIzT0XgYghGTbcF6xOQGiqXafVJ/v81bt 6XkTElZjv79aYGXc1SpWmLOom3N73TZyBWX9Klsta36TLmi3HflWSq8ZDUzhSMdvj7 MCJTcQ4zxSCFdoFCsOySJ9IJgtl3JoODy4assOHggKte+UmoQgD4bVj3G8TbMTV2/f romH+DheLb0M5CE9YsRXe0RhEXyKuRleXa2Tg/07PcRbpfJGdHwNFlr+tpVrxpo+Sf Zn0Dll3b32ggQ== To: =?utf-8?Q?Ludovic_Court=C3=A8s?= From: John Kehayias Subject: Re: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. Message-ID: <87zgam85yj.fsf@protonmail.com> In-Reply-To: <874jt3xo37.fsf@gnu.org> References: <874jt4k7bl.fsf@protonmail.com> <874jt3xo37.fsf@gnu.org> Feedback-ID: 7805494:user:proton MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_KlcrGRoReiLt1KmLVaEgv37IIFJc5rU47J3DPQ8YQs8" X-Spam-Score: -0.0 (/) 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: -1.0 (-) This is a multi-part message in MIME format. --b1_KlcrGRoReiLt1KmLVaEgv37IIFJc5rU47J3DPQ8YQs8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo=E2=80=99, On Sat, Jan 07, 2023 at 12:03 AM, Ludovic Court=C3=A8s wrote: > To be safe, you need to account for (getenv "PATH") returning #f, and > not add a trailing colon in that case. > Ah, right. I think this would only happen if somehow unsetting PATH and pre= serving it? As 'guix shell' already sets PATH. Anyway, better to be safe he= re. I tweaked this, though not sure if there is a more elegant way to construct= the string than what I did (suggestions always welcome!). > Other than that, I agree this is a valid change because that would be > consistent with: > > $ PATH=3D/foo $(type -P guix) shell -E ^PATH$ -C coreutils -- env |grep ^= PATH > PATH=3D/gnu/store/pfl0lyqbs557khv7rw90bzp24qp2lqsn-profile/bin:/foo > > Perhaps you can add a line to test it in > =E2=80=98tests/guix-environment-container.sh=E2=80=99? > I added two tests while I was at it: one to check that PATH has the FHS mod= ification in the container and a second for this particular bug. For the se= cond one I just used a test string added to PATH as the entire thing will d= iffer already from inside/outside the container, FHS or not. I checked the = tests pass here and removing '--emulate-fhs' causes the first to fail while= removing the '--preserve' argument causes the second test to fail. I could= separate the first out as a separate commit if that makes more sense, but = I do think the current behavior is just wrong in overwriting all of PATH wh= en '--emuate-fhs' is given. New version attached, thanks for the suggestions! John --b1_KlcrGRoReiLt1KmLVaEgv37IIFJc5rU47J3DPQ8YQs8 Content-Type: text/x-patch; name=0001-environment-Fix-emulate-fhs-option-overriding-PATH.patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=0001-environment-Fix-emulate-fhs-option-overriding-PATH.patch RnJvbSBiZWI2ZjkyNTVmYzYyZmU1MmUyMzdmODJjN2U5NTNhMjFiN2Y4MmY0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQ0KRnJvbTogSm9obiBLZWhheWlhcyA8am9obi5rZWhheWlhc0Bwcm90b25t YWlsLmNvbT4NCkRhdGU6IFRodSwgNSBKYW4gMjAyMyAxNjowNjoxOSAtMDUwMA0KU3ViamV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8gYmV0dGVyIG1hdGNoIEZIUyBleHBlY3RhdGlvbnMpLCBhbmQgZ2VuZXJh dGUNCiAgICAgICAgICAgIDs7IC9ldGMvbGQuc28uY2FjaGUuDQotICAgICAgICAgICAoc2V0ZW52 ICJQQVRIIiAiL2JpbjovdXNyL2Jpbjovc2JpbjovdXNyL3NiaW4iKQ0KKyAgICAgICAgICAgKHNl dGVudiAiUEFUSCIgKHN0cmluZy1hcHBlbmQgIi9iaW46L3Vzci9iaW46L3NiaW46L3Vzci9zYmlu Ig0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHdoZW4gKGdldGVu diAiUEFUSCIpDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChz dHJpbmctYXBwZW5kICI6IiAoZ2V0ZW52ICJQQVRIIikpKSkpDQogICAgICAgICAgICAoaW52b2tl ICJsZGNvbmZpZyIgIi1YIikpDQogICAgICAgICAgKGFwcGx5IGV4ZWNscCBwcm9ncmFtIHByb2dy YW0gYXJncykpDQogICAgICAgIChsYW1iZGEgXw0KZGlmZiAtLWdpdCBhL3Rlc3RzL2d1aXgtZW52 aXJvbm1lbnQtY29udGFpbmVyLnNoIGIvdGVzdHMvZ3VpeC1lbnZpcm9ubWVudC1jb250YWluZXIu c2gNCmluZGV4IDAzMDZmYzE3NDQuLjE5ODM1MmMxZTIgMTAwNjQ0DQotLS0gYS90ZXN0cy9ndWl4 LWVudmlyb25tZW50LWNvbnRhaW5lci5zaA0KKysrIGIvdGVzdHMvZ3VpeC1lbnZpcm9ubWVudC1j b250YWluZXIuc2gNCkBAIC0xLDYgKzEsNiBAQA0KICMgR05VIEd1aXggLS0tIEZ1bmN0aW9uYWwg cGFja2FnZSBtYW5hZ2VtZW50IGZvciBHTlUNCiAjIENvcHlyaWdodCDCqSAyMDE1IERhdmlkIFRo b21wc29uIDxkYXZldEBnbnUub3JnPg0KLSMgQ29weXJpZ2h0IMKpIDIwMjIgSm9obiBLZWhheWlh cyA8am9obi5rZWhheWlhc0Bwcm90b25tYWlsLmNvbT4NCisjIENvcHlyaWdodCDCqSAyMDIyLCAy MDIzIEpvaG4gS2VoYXlpYXMgPGpvaG4ua2VoYXlpYXNAcHJvdG9ubWFpbC5jb20+DQogIw0KICMg VGhpcyBmaWxlIGlzIHBhcnQgb2YgR05VIEd1aXguDQogIw0KQEAgLTI0Miw2ICsyNDIsMjIgQEAg Z3VpeCBzaGVsbCAtQ0YgLS1ib290c3RyYXAgZ3VpbGUtYm9vdHN0cmFwIGdsaWJjIFwNCiAgICAg ICAgICAgICAgICAgICAgICAgICAgICAwDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgMSkp Jw0KIA0KKyMgVGVzdCB0aGF0ICRQQVRIIGluc2lkZSB0aGUgY29udGFpbmVyIGhhcyBGSFMgZGly ZWN0b3JpZXMuDQorZ3VpeCBzaGVsbCAtQ0YgLS1ib290c3RyYXAgZ3VpbGUtYm9vdHN0cmFwIFwN CisgICAgIC0tIGd1aWxlIC1jICcoZXhpdCAoaWYgKHN0cmluZy1jb250YWlucyAoZ2V0ZW52ICJQ QVRIIikNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIi9iaW46L3Vzci9iaW46L3NiaW46 L3Vzci9zYmluIikNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAwDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgMSkpJw0KKw0KKyMgTWFrZSBzdXJlICctLXByZXNlcnZlJyBpcyBob25v cmVkIGZvciAkUEFUSCwgd2hpY2ggdGhlICctLWVtdWxhdGUtZmhzJw0KKyMgb3B0aW9uIHdpbGwg bW9kaWZ5LiAgV2UgY2FuJ3QgKGVhc2lseSkgY2hlY2sgdGhlIHdob2xlICRQQVRIIGFzIGl0IHdp bGwNCisjIGRpZmZlciBpbnNpZGUgYW5kIG91dHNpZGUgdGhlIGNvbnRhaW5lciwgc28ganVzdCBj aGVjayBmb3IgYW4gYWRkZWQgc3RyaW5nLg0KK1BBVEg9dGhpcy1pcy1hLXRlc3Q6JFBBVEggZ3Vp eCBzaGVsbCAtQ0YgLS1ib290c3RyYXAgZ3VpbGUtYm9vdHN0cmFwIC1FIFBBVEggXA0KKyAgICAg LS0gZ3VpbGUgLWMgJyhleGl0IChpZiAoc3RyaW5nLWNvbnRhaW5zIChnZXRlbnYgIlBBVEgiKQ0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAidGhpcy1pcy1hLXRlc3QiKQ0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgIDANCisgICAgICAgICAgICAgICAgICAgICAgICAgICAxKSknDQor DQogIyAnLS1zeW1saW5rJyB3b3Jrcy4NCiBlY2hvICJURVNUSU5HIFNZTUxJTksgSU4gQ09OVEFJ TkVSIg0KIGd1aXggc2hlbGwgLS1ib290c3RyYXAgZ3VpbGUtYm9vdHN0cmFwIC0tY29udGFpbmVy IFwNCi0tIA0KMi4zOC4xDQoNCg== --b1_KlcrGRoReiLt1KmLVaEgv37IIFJc5rU47J3DPQ8YQs8-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 09:41:29 2023 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: =?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> <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=2C?= 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-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, 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. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 18:05:28 2023 Received: (at 60566-done) by debbugs.gnu.org; 15 Jan 2023 23:05:28 +0000 Received: from localhost ([127.0.0.1]:59891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHC47-0000o2-Re for submit@debbugs.gnu.org; Sun, 15 Jan 2023 18:05:28 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]:39935) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHC46-0000no-3V for 60566-done@debbugs.gnu.org; Sun, 15 Jan 2023 18:05:26 -0500 Date: Sun, 15 Jan 2023 23:05:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1673823920; x=1674083120; bh=1u3kZqJ0rDg2pNKqXwNGXzqAX5bge5+73Qf5Y92d0bU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Mi/Ty+Lp4KOH8XEkK58sI0uFwyMWwlZ4Q2Z/T+5+4rrZ6q3WrJsrxgRH6Dsv/HZGP Bi0rkrEsRflI/YwLEZLXPA8pqjslTJCZu24USw6NjuZPHh1br0FRWQEosBDw33L+yn sje3lThfxEWsJe3AOkksrTc7QpnXbvaHjCTL63G91M0zLf68AbKZZdxEjIrgktKrKJ A1sKUK/PgsLCRPwPapbjGluBU+0NwO+N9AtPbr+VnrUSAFdMjX2K3PkEXxeIpZCZSa eT9IOCUVEuIRzJ7sPui4OFNX1brQc2ip9aoIfYLEIpUzfXxdW4ojETXVXOJIoU5FVq PB4Qyv35p4GnA== To: =?utf-8?Q?Ludovic_Court=C3=A8s?= From: John Kehayias Subject: Re: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. Message-ID: <87wn5n8km5.fsf@protonmail.com> In-Reply-To: <87ilh99o1g.fsf@gnu.org> References: <874jt4k7bl.fsf@protonmail.com> <874jt3xo37.fsf@gnu.org> <87zgam85yj.fsf@protonmail.com> <87ilh99o1g.fsf@gnu.org> Feedback-ID: 7805494:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 60566-done Cc: jman , 60566-done@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: -1.0 (-) Hi Ludo=E2=80=99, On Sat, Jan 14, 2023 at 03:41 PM, Ludovic Court=C3=A8s wrote: > Hi John, > > John Kehayias skribis: > > [...] > >> - (setenv "PATH" "/bin:/usr/bin:/sbin:/usr/sbin") >> + (setenv "PATH" (string-append "/bin:/usr/bin:/sbin:/usr/sbin= " >> + (when (getenv "PATH") >> + (string-append ":" (getenv "= PATH"))))) > > Remember that =E2=80=98when=E2=80=99 returns *unspecified* when the condi= tion is false, > so you=E2=80=99d get a type error here when PATH is undefined. > > Instead write: (if (getenv "PATH") =E2=80=A6 ""). > Ah yes, my Common Lisp showing through and relying on nil instead. Fixed an= d thanks! >> +# 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")). > With this patch PATH now gets the FHS directories in addition to what it no= rmally has (like the profile's bin directory). While slightly redundant, th= is seems to be better than clobbering it. Anyway, so we can't check that th= e PATH is completely equal here. >> +# Make sure '--preserve' is honored for $PATH, which the '--emulate-fhs= ' >> +# option will modify. We can't (easily) check the whole $PATH as it wi= ll >> +# differ inside and outside the container, so just check for an added s= tring. >> +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 ^= PATH=3D.*:/foo > > (I think =E2=80=98--bootstrap=E2=80=99 doesn=E2=80=99t buy us much here b= ecause we have to > download/build =E2=80=98glibc-for-fhs=E2=80=99 anyway. =E2=80=98--bootst= rap=E2=80=99 and > =E2=80=98guile-bootstrap=E2=80=99 are particularly useful for testse that= can run > without network access and without building tons of stuff, as in > =E2=80=98tests/guix-environment.sh=E2=80=99 for instance.) > Ah, thanks, that is nicer if we can just use coreutils. I rewrote the previ= ous test to use that as well. Probably some other tests here could use that= simplification, but outside of the scope here. (Side note that 'type' in zsh works differently, one could use 'whence' the= re or even the built-in 'which'. For the tests we are running with bash or = bash compliant here, so it is not a problem.) > Otherwise LGTM, thanks! > > Ludo=E2=80=99. Thanks again for your careful review! Pushed as 3bfbfa2946aebb7f68c8027ae80= f272f6915c94f and closing this issue. Thanks also for jman for reporting. John From unknown Sat Aug 09 01:40:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 13 Feb 2023 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator