guix build: Fix relative file name canonicalization for '--root'.

Fixes <https://bugs.gnu.org/35271>.
Reported by rendaw <7e9wc56emjakcm@s.rendaw.me>.

* guix/scripts/build.scm (register-root): When ROOT is a relative file
name, append the basename of ROOT, not ROOT itself.
* tests/guix-build.sh: Add test.
This commit is contained in:
Ludovic Courtès 2019-04-15 16:57:12 +02:00
parent cbd059d101
commit 4aea820f09
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 8 additions and 1 deletions

View File

@ -119,7 +119,7 @@ found. Return #f if no build log was found."
(let* ((root (if (string-prefix? "/" root)
root
(string-append (canonicalize-path (dirname root))
"/" root))))
"/" (basename root)))))
(catch 'system-error
(lambda ()
(match paths

View File

@ -183,6 +183,13 @@ then false; else true; fi
rm -f "$result"
# Check relative file name canonicalization: <https://bugs.gnu.org/35271>.
mkdir "$result"
guix build -r "$result/x" -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'
test -x "$result/x/bin/guile"
rm "$result/x"
rmdir "$result"
# Cross building.
guix build coreutils --target=mips64el-linux-gnu --dry-run --no-substitutes