GNU bug report logs - #78210
[PATCH] guix: include store parent dirs in docker layer

Previous Next

Package: guix-patches;

Reported by: Ray Miller <ray <at> 1729.org.uk>

Date: Fri, 2 May 2025 11:46:03 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Full log


View this message in rfc822 format

From: Ray Miller <ray <at> 1729.org.uk>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 78210 <at> debbugs.gnu.org
Subject: [bug#78210] [PATCH] guix: include store parent dirs in docker layer
Date: Sat, 24 May 2025 17:53:16 +0100
Hi Ludo,

Thank you for the feedback and suggestions.

On 18/05/2025 21:34, Ludovic Courtès wrote:
> Neat!
>
> Could you include in the commit log a line like:
>
>    Fixes <https://issues.guix.gnu.org/XYZ>.
>
> … so we can keep track of where this was reported and discussed?
>
Done.

>> +++ b/guix/scripts/pack.scm
>> @@ -580,9 +580,11 @@ (define* (docker-image name profile
>>                        (,source -> ,target))))))
>>
>>               (define directives
>> -              ;; Create a /tmp directory, as some programs expect it, and
>> -              ;; create SYMLINKS.
>> +              ;; Create /tmp, /gnu, and /gnu/store directories, as some
>> +              ;; programs expect them, and create SYMLINKS.
>>                 `((directory "/tmp" ,(getuid) ,(getgid) #o1777)
>> +                (directory "/gnu" ,(getuid) ,(getgid) #o755)
>> +                (directory "/gnu/store" ,(getuid) ,(getgid) #o755)
> It’s a bit trickier, because “/gnu/store” is not hardcoded.
Ah, OK. Good catch!
> Instead, you need to recurse over the components of (%store-prefix), so
> something like:
>
>    `((directory "/tmp" …)
>      #$@(map (lambda (component)
>                #~(directory #$component …))
>              (string-tokenize (%store-prefix)
>                               (char-set-complement (char-set #\/)))))

It turns out to be a bit simpler because these directives are processed by
evaluate-populate-directive which calls mkdir-p. (I discovered this after
implementing a recursive solution then thinking "there must be a better
way" and reading some source code...)

> But perhaps this should actually be done in (guix docker) so that ‘guix
> system image -t docker’ also benefits from it?
I tested this by running 'guix systemimage -t docker' and inspecting the
layer it generates. It turns out not to suffer from the same problem: the
store directory is present in the layer.

Updated patch to follow.

Ray.




This bug report was last modified 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.