unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer")
Cc: 21613@debbugs.gnu.org
Subject: bug#21613: Include messes up when compiling file in load path
Date: Fri, 24 Jun 2016 16:49:05 +0200	[thread overview]
Message-ID: <87d1n6fxr2.fsf@pobox.com> (raw)
In-Reply-To: <8737xqaefu.fsf@T420.taylan> ("Taylan Ulrich \"Bayırlı/Kammer\""'s message of "Sun, 04 Oct 2015 16:36:21 +0200")

On Sun 04 Oct 2015 16:36, taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") writes:

> $ mkdir test
> $ echo '(include "test2.scm")' > test/test1.scm
> $ echo '(display "foo\n")' > test/test2.scm
> $ pwd
> /home/taylan
> $ export GUILE_LOAD_PATH=/home/taylan/test
> $ unset GUILE_LOAD_COMPILED_PATH
> $ guile -L test test/test1.scm
...
> ERROR: In procedure open-file:
> ERROR: In procedure open-file: No such file or directory: "./test2.scm"

The way this works is that test/test1.scm is opened.  To set the
port-filename of the port, Guile uses "relative" canonicalization of the
path, which will result in "test1.scm" being the port-filename, as we
found test1.scm in test/.  After that it all breaks down -- the
intention is for `include' of a relative path to look for it relative to
the dirname of the file doing the including, but (dirname "test1.scm")
is ".", so it looks for "./test2.scm"... bogus.

The intention of relative canonicalization is to allow for errors to be
signalled relative to a path-relative file name.  For example in a
recent backtrace:

In ice-9/psyntax.scm:
  1200:36  5 (expand-top-sequence ((include "test2.scm")) _ _ #f e # #)

The fact that it's ice-9/psyntax.scm comes from there.  You can build
the file locally and install it and it the debugging information doesn't
embed the full dirname of the build tree.

But, for that to work well, you really need `include-from-path' and not
`include'.  All of the uses of `include' in Guile itself are really
`include-from-path'.  And if you use `include' in a file which is in a
path... well I guess that's not working.

Clearly going backwards from a relative path to an absolute path is not
going to work.  I guess my only proposal would be to include the
absolute path of a file port, in addition to the relative path.  I guess
that would be somewhere around the call to fport_canonicalize_filename
in fports.c.

Thoughts?

Andy





      parent reply	other threads:[~2016-06-24 14:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04 14:36 bug#21613: Include messes up when compiling file in load path Taylan Ulrich Bayırlı/Kammer
2015-10-04 22:31 ` Taylan Ulrich Bayırlı/Kammer
2016-06-21  8:49   ` Taylan Ulrich Bayırlı/Kammer
2016-06-24 14:49 ` Andy Wingo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1n6fxr2.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=21613@debbugs.gnu.org \
    --cc=taylanbayirli@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).