From b908fcd8c02c26b1e6cdc636b63306a01a21b994 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 23 Aug 2019 17:45:17 +0200 Subject: pack: '-R' honors the requested output. Fixes . Reported by Jesse Gibbons . * guix/scripts/pack.scm (wrapped-package): Add 'output*' parameter. [build]: Define 'input' and 'target'; use them instead of #$package and #$output, respectively. (wrapped-manifest-entry): New procedure. (map-manifest-entries): Call PROC directly. (guix-pack): Pass WRAPPED-MANIFEST-ENTRY to 'map-manifest-entries'. --- tests/guix-pack-relocatable.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/guix-pack-relocatable.sh b/tests/guix-pack-relocatable.sh index ebada62c01..e93610eedc 100644 --- a/tests/guix-pack-relocatable.sh +++ b/tests/guix-pack-relocatable.sh @@ -78,3 +78,9 @@ else "$test_directory/Bin/sed" --version > "$test_directory/output" fi grep 'GNU sed' "$test_directory/output" +chmod -Rf +w "$test_directory"; rm -rf "$test_directory"/* + +# Ensure '-R' works with outputs other than "out". +tarball="`guix pack -R -S /share=share groff:doc`" +(cd "$test_directory"; tar xvf "$tarball") +test -d "$test_directory/share/doc/groff/html" -- cgit v1.2.3 From 7979a287f8eb84cbbfa44629951572408939a756 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 27 Aug 2019 11:27:02 +0200 Subject: pack: Create /tmp in Docker images. Fixes . * guix/scripts/pack.scm (docker-image)[build]: Add a 'directory' entry for "/tmp" to DIRECTIVES. * tests/pack.scm ("docker-image + localstatedir"): Test the presence of /tmp. * gnu/tests/docker.scm (run-docker-test)["Load docker image and run it"]: Test the presence and permission bits of "/tmp". --- gnu/tests/docker.scm | 13 ++++++++++--- guix/scripts/pack.scm | 6 ++++-- tests/pack.scm | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm index 3ec5c3d6ee..3f98a1e316 100644 --- a/gnu/tests/docker.scm +++ b/gnu/tests/docker.scm @@ -100,7 +100,7 @@ inside %DOCKER-OS." marionette)) (test-equal "Load docker image and run it" - '("hello world" "hi!" "JSON!") + '("hello world" "hi!" "JSON!" #o1777) (marionette-eval `(begin (define slurp @@ -131,8 +131,15 @@ inside %DOCKER-OS." ,(string-append #$docker-cli "/bin/docker") "run" repository&tag "-c" "(use-modules (json)) - (display (json-string->scm (scm->json-string \"JSON!\")))"))) - (list response1 response2 response3))) + (display (json-string->scm (scm->json-string \"JSON!\")))")) + + ;; Check whether /tmp exists. + (response4 (slurp + ,(string-append #$docker-cli "/bin/docker") + "run" repository&tag "-c" + "(display (stat:perms (lstat \"/tmp\")))"))) + (list response1 response2 response3 + (string->number response4)))) marionette)) (test-end) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index a15530ad70..dd91a24284 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -511,8 +511,10 @@ the image." (,source -> ,target)))))) (define directives - ;; Fully-qualified symlinks. - (append-map symlink->directives '#$symlinks)) + ;; Create a /tmp directory, as some programs expect it, and + ;; create SYMLINKS. + `((directory "/tmp" ,(getuid) ,(getgid) #o1777) + ,@(append-map symlink->directives '#$symlinks))) (setenv "PATH" (string-append #$archiver "/bin")) diff --git a/tests/pack.scm b/tests/pack.scm index ea88cd89f2..71ff5aec18 100644 --- a/tests/pack.scm +++ b/tests/pack.scm @@ -169,6 +169,7 @@ (when (and (file-exists? (string-append bin "/guile")) (file-exists? "var/guix/db/db.sqlite") + (file-is-directory? "tmp") (string=? (string-append #$%bootstrap-guile "/bin") (pk 'binlink (readlink bin))) (string=? (string-append #$profile "/bin/guile") -- cgit v1.2.3 From dd4e46edda6c255ca170a6650c6f92b16ff50a3f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 27 Aug 2019 22:38:04 +0200 Subject: accounts: Delete duplicate entries. When adding multiple instances of a service requiring some user account/group, we could end up with multiple entries for that account or group in /etc/passwd or /etc/group. * gnu/build/accounts.scm (database-writer)[write-entries]: Add call to 'delete-duplicates'. * tests/accounts.scm ("write-passwd with duplicate entry"): New test. --- gnu/build/accounts.scm | 2 +- tests/accounts.scm | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/gnu/build/accounts.scm b/gnu/build/accounts.scm index 5094456ab1..f60d68d9b3 100644 --- a/gnu/build/accounts.scm +++ b/gnu/build/accounts.scm @@ -238,7 +238,7 @@ to it atomically and set the appropriate permissions." (for-each (lambda (entry) (display (entry->string entry) port) (newline port)) - entries)) + (delete-duplicates entries))) (if (port? file-or-port) (write-entries file-or-port) diff --git a/tests/accounts.scm b/tests/accounts.scm index 673dd42432..78136390bb 100644 --- a/tests/accounts.scm +++ b/tests/accounts.scm @@ -62,6 +62,25 @@ nobody:!:0::::::\n")) (shell "/bin/sh"))) port)))) +(test-equal "write-passwd with duplicate entry" + %passwd-sample + (call-with-output-string + (lambda (port) + (let ((charlie (password-entry + (name "charlie") + (uid 1000) (gid 998) + (real-name "Charlie") + (directory "/home/charlie") + (shell "/bin/sh")))) + (write-passwd (list (password-entry + (name "root") + (uid 0) (gid 0) + (real-name "Admin") + (directory "/root") + (shell "/bin/sh")) + charlie charlie) + port))))) + (test-equal "read-passwd + write-passwd" %passwd-sample (call-with-output-string -- cgit v1.2.3