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

To reply to this bug, email your comments to 78210 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#78210; Package guix-patches. (Fri, 02 May 2025 11:46:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ray Miller <ray <at> 1729.org.uk>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 02 May 2025 11:46:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ray Miller <ray <at> 1729.org.uk>
To: guix-patches <at> gnu.org
Subject: [PATCH] guix: include store parent dirs in docker layer
Date: Fri, 2 May 2025 11:43:16 +0100
[Message part 1 (text/plain, inline)]
This patch adds the /gnu and /gnu/store directories to the Docker layer
created by `guix pack -f docker ...` which enables the Docker image to be
used to create an AWS Lambda function. Without the patch, creating the AWS
Lambda function fails with this error:

"MissingParentDirectory: Parent directory does not exist for file: 
gnu/store/zic27jikg36d6wjj4cz8hyriyfl3ygiz-info-dir/"

My first attempt to fix this was just to add the /gnu and /gnu/store 
directories
to `directives` but the Docker image failed in AWS Lambda with the same 
error. These
directories need to appear in the tarball for the layer *before* the 
packages,
so the change to the order of the tar arguments is also needed.

* guix/scripts/pack.scm: add /gnu and /gnu/store directories to the
docker layer.
* guix/docker.scm: change order of arguments to tar so parent
directories are added before their contents.

Change-Id: I2b103c59981e828c965564ccc5d2415b00a7e52e
---
guix/docker.scm       | 4 ++--
guix/scripts/pack.scm | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/docker.scm b/guix/docker.scm
index 60ce13cbde..9911bb84bb 100644
--- a/guix/docker.scm
+++ b/guix/docker.scm
@@ -365,10 +365,10 @@ (define* (build-docker-image image paths prefix
                (apply invoke "tar" "-cf" "../layer.tar"
                       `(,@transformation-options
                         ,@(tar-base-options)
-                         ,@(if max-layers '() paths)
                         ,@(scandir "."
                                    (lambda (file)
-                                      (not (member file '("." ".."))))))))
+                                      (not (member file '("." "..")))))
+                         ,@(if max-layers '() paths))))
              (delete-file-recursively "extra")))

        ;; It is possible for "/" to show up in the archive, especially 
when
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 7ab2c0d447..5cb9cd0b48 100644
--- a/guix/scripts/pack.scm
+++ 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)
                ,@(append-map symlink->directives '#$symlinks)))

            (define (form-entry-point prefix entry-point 
entry-point-argument)

base-commit: 4fe4cf9fdd959126d3c53c3df4504d851e7b736a
-- 
2.47.1


[OpenPGP_0x043F786C4CD681B8.asc (application/pgp-keys, attachment)]
[OpenPGP_signature.asc (application/pgp-signature, attachment)]

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.