me
/
guix
Archived
1
0
Fork 0

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>
master
JOULAUD François 2021-01-18 08:26:02 +00:00 committed by Ludovic Courtès
parent f97ee77418
commit 4d79f072cc
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 8 additions and 2 deletions

View File

@ -675,7 +675,7 @@ message if any test fails."
(let* ((root (if (string-prefix? "/" root) (let* ((root (if (string-prefix? "/" root)
root root
(string-append (canonicalize-path (dirname root)) (string-append (canonicalize-path (dirname root))
"/" root)))) "/" (basename root)))))
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
(symlink target root) (symlink target root)

View File

@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU # 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. # This file is part of GNU Guix.
# #
@ -121,6 +121,12 @@ guix environment --bootstrap -r "$gcroot" --ad-hoc guile-bootstrap \
test `readlink "$gcroot"` = "$expected" test `readlink "$gcroot"` = "$expected"
rm "$gcroot" 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. # Same with an absolute file name.
guix environment --bootstrap -r "$PWD/$gcroot" --ad-hoc guile-bootstrap \ guix environment --bootstrap -r "$PWD/$gcroot" --ad-hoc guile-bootstrap \
-- guile -c 1 -- guile -c 1