From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#21613: Include messes up when compiling file in load path Date: Fri, 24 Jun 2016 16:49:05 +0200 Message-ID: <87d1n6fxr2.fsf@pobox.com> References: <8737xqaefu.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466779834 25839 80.91.229.3 (24 Jun 2016 14:50:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2016 14:50:34 +0000 (UTC) Cc: 21613@debbugs.gnu.org To: taylanbayirli@gmail.com (Taylan Ulrich "=?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer?=") Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Jun 24 16:50:22 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGSR3-0005MG-Gc for guile-bugs@m.gmane.org; Fri, 24 Jun 2016 16:50:21 +0200 Original-Received: from localhost ([::1]:44047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGSR2-0003X2-LN for guile-bugs@m.gmane.org; Fri, 24 Jun 2016 10:50:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGSQp-0003RE-QS for bug-guile@gnu.org; Fri, 24 Jun 2016 10:50:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGSQk-00050d-QR for bug-guile@gnu.org; Fri, 24 Jun 2016 10:50:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGSQk-00050Z-MJ for bug-guile@gnu.org; Fri, 24 Jun 2016 10:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGSQk-00050t-GP for bug-guile@gnu.org; Fri, 24 Jun 2016 10:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 24 Jun 2016 14:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21613 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 21613-submit@debbugs.gnu.org id=B21613.146677975919209 (code B ref 21613); Fri, 24 Jun 2016 14:50:02 +0000 Original-Received: (at 21613) by debbugs.gnu.org; 24 Jun 2016 14:49:19 +0000 Original-Received: from localhost ([127.0.0.1]:54432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGSQ3-0004zl-0V for submit@debbugs.gnu.org; Fri, 24 Jun 2016 10:49:19 -0400 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:59709 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGSQ1-0004zb-EZ for 21613@debbugs.gnu.org; Fri, 24 Jun 2016 10:49:17 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id DEF9721EFF; Fri, 24 Jun 2016 10:49:13 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=yODMHfi2r/s2 X4lC7BVADazr2YA=; b=rv28Y53o01K9L2ViE8k8QG7rdH6i1cD6E+0gNKYF4p5k zKjOOtNXYGNun27IPac8Hd8TjY8lNCv+N0eOwzbuoebTqmpk+lgL/7tS4nEKb0Ba bJU+kF/PCkkVZ6sZkR2LVhxqOmThPnK7TvpTJPO5AUwscCvELs6MxSFsMqhZwBw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=QwaAcH e6otaHGMsGVAP95Ym4Kusd3EjljVlegrS2WgK72eGBDObtbbXssssym68W4TERGs JVQ/Epqm+lt10ZlJDX5hEnBLuFoZAsN+FfwUS4qO/m0f/52qFW7/uDkWqSJlBQEM dD391j5zBr2vo2vPuFVWEHJr0mqdooKamZVFM= Original-Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id D6AFC21EFD; Fri, 24 Jun 2016 10:49:13 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 224C221EFC; Fri, 24 Jun 2016 10:49:13 -0400 (EDT) In-Reply-To: <8737xqaefu.fsf@T420.taylan> ("Taylan Ulrich \"=?UTF-8?Q?Bay=C4=B1rl=C4=B1/Kammer\?=""'s message of "Sun, 04 Oct 2015 16:36:21 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: D12F9F50-3A1A-11E6-A84B-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8222 Archived-At: On Sun 04 Oct 2015 16:36, taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1= rl=C4=B1/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=3D/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