[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/08: environment: Fix '--root' option with relative file name.
From: |
guix-commits |
Subject: |
02/08: environment: Fix '--root' option with relative file name. |
Date: |
Tue, 19 Jan 2021 12:15:30 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 4d79f072cc7b502fc25486d514c9200ba684a596
Author: JOULAUD François <Francois.JOULAUD@radiofrance.com>
AuthorDate: Mon Jan 18 08:26:02 2021 +0000
environment: Fix '--root' option with relative file name.
The path normalization of `--root` option of `guix environment` was
buggy as it appended full argument after normalized directory. This
patch fixes it.
* guix/scripts/environment.scm (register-gc-root): Fix gc-root path
normalization.
* tests/guix-environment.sh: Add test.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
guix/scripts/environment.scm | 2 +-
tests/guix-environment.sh | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index fbc202c..f4d12f8 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -675,7 +675,7 @@ message if any test fails."
(let* ((root (if (string-prefix? "/" root)
root
(string-append (canonicalize-path (dirname root))
- "/" root))))
+ "/" (basename root)))))
(catch 'system-error
(lambda ()
(symlink target root)
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index f8be48f..afadcbe 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2015, 2016, 2017, 2018, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -121,6 +121,12 @@ guix environment --bootstrap -r "$gcroot" --ad-hoc
guile-bootstrap \
test `readlink "$gcroot"` = "$expected"
rm "$gcroot"
+# Try '-r' with a relative file name.
+(cd "$tmpdir"; mkdir "gc-root";
+ guix environment --bootstrap -r "gc-root/r" --ad-hoc guile-bootstrap \
+ -- guile -c 1;
+ rm "gc-root/r"; rmdir "gc-root")
+
# Same with an absolute file name.
guix environment --bootstrap -r "$PWD/$gcroot" --ad-hoc guile-bootstrap \
-- guile -c 1
- branch master updated (e74baa1 -> ff34f8a), guix-commits, 2021/01/19
- 02/08: environment: Fix '--root' option with relative file name.,
guix-commits <=
- 03/08: gnu: esbuild: Update to 0.8.32., guix-commits, 2021/01/19
- 05/08: gnu: xfce4-appfinder: Update to 4.16.1., guix-commits, 2021/01/19
- 06/08: gnu: rpcbind: Update to 1.2.5., guix-commits, 2021/01/19
- 08/08: news: Add entry for '--with-latest'., guix-commits, 2021/01/19
- 01/08: modules: Recognize #:re-export-and-replace., guix-commits, 2021/01/19
- 04/08: gnu: motion: Update to 4.3.2., guix-commits, 2021/01/19
- 07/08: transformations: Add '--with-latest'., guix-commits, 2021/01/19