bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58861: [PATCH] shell: Fix '--emulate-fhs' sometimes not including 'g


From: John Kehayias
Subject: bug#58861: [PATCH] shell: Fix '--emulate-fhs' sometimes not including 'glibc-for-fhs'.
Date: Thu, 03 Nov 2022 18:50:14 +0000

Hi Ludo’,

On Wed, Nov 02, 2022 at 04:50 PM, Ludovic Courtès wrote:

> Hi John,
>
> John Kehayias <john.kehayias@protonmail.com> skribis:
>
>> After commit
>> <https://git.savannah.gnu.org/cgit/guix.git/commit/?id=c07b55eb94f8cfa9d0f56cfd97a16f2f7d842652>
>> I noticed a changed in behavior of guix shell with the emulate-fhs option 
>> for a
>> container. I tracked it down to the wrong glibc package appearing in the 
>> container, i.e.
>> the standard Guix version rather than glibc-for-fhs (which reads a global ld 
>> cache).
>>
>> The cause I believe is related to <https://issues.guix.gnu.org/58859>, 
>> namely that
>> package input order for a profile can matter. But it is slightly different 
>> here since
>> the glibc-for-fhs package is added internally.
>>
>> We can see this demonstrated by comparing the FHS container with a -D input 
>> so that a
>> glibc package is implicitly included (here from the gnu-build-system):
>>
>> ❯ guix shell -CFD hello coreutils
>> john@narya ~/Files/UPenn/canvasgrading [env]$ ls /lib/ld* -la
>> lrwxrwxrwx 1 65534 overflow 69 Jan 1 1970 /lib/ld-2.33.so ->
>> /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-2.33.so
>> lrwxrwxrwx 1 65534 overflow 79 Jan 1 1970 /lib/ld-linux-x86-64.so.2 ->
>> /gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.33/lib/ld-linux-x86-64.so.2
>
> How about fixing it by moving the (alist-cons 'expression …) thing right
> before the ‘options-with-caching’ call in ‘parse-args’?
>
> That way it would no longer be sensitive to the position of ‘-F’ on the
> command line.
>

Good idea, that worked! I didn't think right away of an easier way of doing 
this, so I added another let binding to easily check for '--emulate-fhs' in the 
parsed arguments.

> Could you give it a try and add a test?
>

I added a test that explicitly includes 'glibc' in the 'guix shell' invocation 
and checked the link to '/lib/libc.so' was from 'glibc-for-fhs'. Again, not 
sure if there is a better way here, but the test does pass now and fails 
without the change you proposed. I also checked against the examples I gave 
originally and looked good there too.

Patch attached. I included an explanation (and link) of this bug and the fix in 
the commit message.

Thanks and let me know if there is anything to improve here!

John

Attachment: 0001-shell-Fix-emulate-fhs-sometimes-not-including-glibc-.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]