summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorJohn Kehayias <john.kehayias@protonmail.com>2022-11-03 14:25:09 -0400
committerLudovic Courtès <ludo@gnu.org>2022-11-06 12:38:02 +0100
commit905443abb742315d89901f3b011980ac796d78a4 (patch)
treec3150565cb38b905ae0bcc566c5c68f2d046d757 /tests
parentf1b0b2344c4c6465cd6033128366e86fa16e5f23 (diff)
downloadguix-905443abb742315d89901f3b011980ac796d78a4.tar.gz
shell: Fix '--emulate-fhs' sometimes not including 'glibc-for-fhs'.
Fixes <https://issues.guix.gnu.org/58861>.

Previously the order of the options giving to 'guix shell' could mean that the
'glibc-for-fhs' package included with the '--emulate-fhs' option would not
appear in the container.  For example, using the development option with a
package using the 'gnu-build-system', e.g. 'guix shell -CFD hello', would
include the regular 'glibc' package.  The option ordered mattered: 'guix shell
-CD hello -F' would include the expected 'glibc-for-fhs'.  We fix this by
having 'glibc-for-fhs' added to the package list just before calling
'options-with-caching' so the option order given by the user does not matter.

* guix/scripts/shell.scm (%options): Move the '--emulate-fhs' (expression
. ...) component from here...
(parse-args): ... to here.
* tests/guix-environment-container.sh: Add a test to check that
'glibc-for-fhs' is in the container even when 'glibc' is included in the 'guix
shell' package list.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-environment-container.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh
index f233c3fcc0..fb2c19b193 100644
--- a/tests/guix-environment-container.sh
+++ b/tests/guix-environment-container.sh
@@ -1,5 +1,6 @@
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2015 David Thompson <davet@gnu.org>
+# Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -231,3 +232,12 @@ guix shell -C --emulate-fhs --bootstrap guile-bootstrap \
 # Test that the ld cache was generated and can be successfully read.
 guix shell -CF --bootstrap guile-bootstrap \
      -- guile -c '(execlp "ldconfig" "ldconfig" "-p")'
+
+# Test that the package glibc-for-fhs is in the container even if there is the
+# regular glibc package from another source.  See
+# <https://issues.guix.gnu.org/58861>.
+guix shell -CF --bootstrap guile-bootstrap glibc \
+     -- guile -c '(exit (if (string-contains (readlink "/lib/libc.so")
+                            "glibc-for-fhs")
+                           0
+                           1))'