diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 3c79e89f8d09b274e0de070d34457c86332076e9..7d4e474e926e9f905af14bcf0241631bab6df32f 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -178,7 +178,10 @@ (define script (lambda () (set-program-arguments script) (set-user-module) - (load-in-vicinity "." (car script))))) + + ;; When passed a relative file name, 'load-in-vicinity' searches the + ;; file in %LOAD-PATH. Thus, pass (getcwd) instead of ".". + (load-in-vicinity (getcwd) (car script))))) (when (null? script) ;; Start REPL diff --git a/tests/guix-repl.sh b/tests/guix-repl.sh index e1c2b8241fe0a96540bda396c7d895bca0e01e20..d4ebb5f6c68d7cbce427eb46c10dd0da40c2c582 100644 --- a/tests/guix-repl.sh +++ b/tests/guix-repl.sh @@ -45,6 +45,10 @@ EOF test "`guix repl "$tmpfile"`" = "coreutils" +# Make sure that the file can also be loaded when passed as a relative file +# name. +(cd "$(dirname "$tmpfile")"; test "$(guix repl "$(basename "$tmpfile")")" = "coreutils") + cat > "$module_dir/foo.scm"<<EOF (define-module (foo)