GNU bug report logs -
#60566
guix container with FHS emulation and env vars
Previous Next
Reported by: jman <jman <at> city17.xyz>
Date: Thu, 5 Jan 2023 04:34:01 UTC
Severity: normal
Done: John Kehayias <john.kehayias <at> protonmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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 (text/x-patch, attachment)]
This bug report was last modified 2 years and 177 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.