[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60566: [PATCH] environment: Fix '--emulate-fhs' option overriding $P
From: |
John Kehayias |
Subject: |
bug#60566: [PATCH] environment: Fix '--emulate-fhs' option overriding $PATH. |
Date: |
Fri, 13 Jan 2023 21:44:59 +0000 |
Hi Ludo’,
On Sat, Jan 07, 2023 at 12:03 AM, Ludovic Courtès 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
preserving it? As 'guix shell' already sets PATH. Anyway, better to be safe
here.
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=/foo $(type -P guix) shell -E ^PATH$ -C coreutils -- env |grep ^PATH
> PATH=/gnu/store/pfl0lyqbs557khv7rw90bzp24qp2lqsn-profile/bin:/foo
>
> Perhaps you can add a line to test it in
> ‘tests/guix-environment-container.sh’?
>
I added two tests while I was at it: one to check that PATH has the FHS
modification in the container and a second for this particular bug. For the
second one I just used a test string added to PATH as the entire thing will
differ 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 when
'--emuate-fhs' is given.
New version attached, thanks for the suggestions!
John
0001-environment-Fix-emulate-fhs-option-overriding-PATH.patch
Description: Text Data