Subject: bug#21613: Include messes up when compiling file in load path

From: [email-masked] (Taylan Ulrich Bayırlı/Kammer)
Date: Mon, 05 Oct 2015 00:31:34 +0200

[email-masked] (Taylan Ulrich "Bayırlı/Kammer") writes:

> This seems to be related to 'compile-file' setting
> '%file-port-name-canonicalization' to 'relative', but I don't know
> what the correct fix is.

With the following trivial patch changing 'relative' to 'absolute',
Guile's test suite passes and the bug seems to be fixed, but I still
don't know whether this is the right fix...

>From 3e508926631a6fe3d81f6a584352562afc0e96ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <[email-masked]>
Date: Mon, 5 Oct 2015 00:15:56 +0200
Subject: [PATCH] Fix 'include' for files in load path.

Fixes <http://debbugs.gnu.org/21613>.

* module/system/base/compile.scm (compile-file): Set
  %file-port-name-canonicalization to 'absolute by default.
(compile-and-load): Ditto.
---
 module/system/base/compile.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index c522b74..66eec44 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -136,7 +136,7 @@
                        (to 'objcode)
                        (env (default-environment from))
                        (opts '())
-                       (canonicalization 'relative))
+                       (canonicalization 'absolute))
   (with-fluids ((%file-port-name-canonicalization canonicalization))
     (let* ((comp (or output-file (compiled-file-name file)
                      (error "failed to create path for auto-compiled file"
@@ -157,7 +157,7 @@
 
 (define* (compile-and-load file #:key (from (current-language)) (to 'value)
                            (env (current-module)) (opts '())
-                           (canonicalization 'relative))
+                           (canonicalization 'absolute))
   (with-fluids ((%file-port-name-canonicalization canonicalization))
     (read-and-compile (open-input-file file)
                       #:from from #:to to #:opts opts
-- 
2.5.0