GNU bug report logs - #49452
Confusing behavior with (include) used in file in GUILE_LOAD_PATH

Previous Next

Package: guile;

Reported by: Vijay Marupudi <vijaymarupudi <at> gatech.edu>

Date: Wed, 7 Jul 2021 06:29:02 UTC

Severity: normal

Merged with 21613, 66046, 70778

To reply to this bug, email your comments to 49452 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#49452; Package guile. (Wed, 07 Jul 2021 06:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vijay Marupudi <vijaymarupudi <at> gatech.edu>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 07 Jul 2021 06:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vijay Marupudi <vijaymarupudi <at> gatech.edu>
To: bug-guile <at> gnu.org
Subject: Confusing behavior with (include) used in file in GUILE_LOAD_PATH
Date: Tue, 6 Jul 2021 19:31:38 -0500
Hello all,

It is unclear to me what the intended behavior for (include
"filename.scm") is, so I'm sending an email about this potential bug.

The Local Inclusion docs
<https://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html>
seem to state that relative paths are found relative to the file that
included them.

> If file-name is a relative path, it is searched for relative to the
> path that contains the file that the include form appears in.

So if I have a file "/libraries/libname/main.scm" than has (include
"./helpers.scm"), then the file "/libraries/libname/helpers.scm"
*should* (I think) be imported.

But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
and my current working directory is somewhere else, say "/home/user" and
I'm running "/home/user/program.scm" that imports the (libname main)
library from "/libraries". Then Guile seems to try to include the
"libname/helpers.scm" file from the current directory, which does not
exist.

Conversations with leoprikler in IRC have revealed to me that
call-with-include-port is the function responsible for this behavior
<https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/psyntax.scm#n3231>.
`syntax-source` returns a file path relative to the load path, and
include tries to use that path to open a file relative to the current
working directory.

In Guile's bug guidelines
<https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Reporting-Bugs.html>,
to me this fits

* Whenever documentation and actual behavior differ, you have certainly
  found a bug, either in the documentation or in the program.

and potentially

* When some part of the documentation is not clear and does not make
  sense to you even after re-reading the section, it is a bug.

I believe this is a bug, but I may be wrong, so emailing to clarify.
Thank you!

Vijay Marupudi
PhD Student in Human Centered-Computing
Georgia Institute of Technology





Information forwarded to bug-guile <at> gnu.org:
bug#49452; Package guile. (Wed, 07 Jul 2021 08:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 49452 <at> debbugs.gnu.org (full text, mbox):

From: Taylan Kammer <taylan.kammer <at> gmail.com>
To: Vijay Marupudi <vijaymarupudi <at> gatech.edu>, 49452 <at> debbugs.gnu.org
Subject: Re: bug#49452: Confusing behavior with (include) used in file in
 GUILE_LOAD_PATH
Date: Wed, 7 Jul 2021 10:29:49 +0200
On 07.07.2021 02:31, Vijay Marupudi wrote:
> Hello all,
> 
> It is unclear to me what the intended behavior for (include
> "filename.scm") is, so I'm sending an email about this potential bug.
> 
> The Local Inclusion docs
> <https://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html>
> seem to state that relative paths are found relative to the file that
> included them.
> 
>> If file-name is a relative path, it is searched for relative to the
>> path that contains the file that the include form appears in.
> 
> So if I have a file "/libraries/libname/main.scm" than has (include
> "./helpers.scm"), then the file "/libraries/libname/helpers.scm"
> *should* (I think) be imported.
> 
> But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
> and my current working directory is somewhere else, say "/home/user" and
> I'm running "/home/user/program.scm" that imports the (libname main)
> library from "/libraries". Then Guile seems to try to include the
> "libname/helpers.scm" file from the current directory, which does not
> exist.
> 
> Conversations with leoprikler in IRC have revealed to me that
> call-with-include-port is the function responsible for this behavior
> <https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/psyntax.scm#n3231>.
> `syntax-source` returns a file path relative to the load path, and
> include tries to use that path to open a file relative to the current
> working directory.
> 
> In Guile's bug guidelines
> <https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Reporting-Bugs.html>,
> to me this fits
> 
> * Whenever documentation and actual behavior differ, you have certainly
>   found a bug, either in the documentation or in the program.
> 
> and potentially
> 
> * When some part of the documentation is not clear and does not make
>   sense to you even after re-reading the section, it is a bug.
> 
> I believe this is a bug, but I may be wrong, so emailing to clarify.
> Thank you!
> 
> Vijay Marupudi
> PhD Student in Human Centered-Computing
> Georgia Institute of Technology

Hi Vijay,

I believe this is the same bug as this one I reported 5-6 years ago:

https://bugs.gnu.org/21613

Sadly there was no progress on it as far as I know.

-- 
Taylan




Information forwarded to bug-guile <at> gnu.org:
bug#49452; Package guile. (Wed, 07 Jul 2021 21:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 49452 <at> debbugs.gnu.org (full text, mbox):

From: Bengt Richter <bokr <at> bokr.com>
To: Vijay Marupudi <vijaymarupudi <at> gatech.edu>
Cc: 49452 <at> debbugs.gnu.org
Subject: Re: bug#49452: Confusing behavior with (include) used in file in
 GUILE_LOAD_PATH
Date: Wed, 7 Jul 2021 23:22:56 +0200
Hi Vijay,

On +2021-07-06 19:31:38 -0500, Vijay Marupudi wrote:
> Hello all,
> 
> It is unclear to me what the intended behavior for (include
> "filename.scm") is, so I'm sending an email about this potential bug.
> 
> The Local Inclusion docs
> <https://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html>
> seem to state that relative paths are found relative to the file that
> included them.
> 
> > If file-name is a relative path, it is searched for relative to the
> > path that contains the file that the include form appears in.
> 
> So if I have a file "/libraries/libname/main.scm" than has (include
> "./helpers.scm"), then the file "/libraries/libname/helpers.scm"
> *should* (I think) be imported.
>

A little nit, but
    (include "filename.scm")
is not identical to
    (include "./filename.scm")
so might it be worth trying
   (include "helpers.scm")
in your code?

And/or should the docs explain that both ways of writing a relative
file name in this context are or are not acceptable?

Might some macro dislike leading dots?

Long shot ;-)

> But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
> and my current working directory is somewhere else, say "/home/user" and
> I'm running "/home/user/program.scm" that imports the (libname main)
> library from "/libraries". Then Guile seems to try to include the
> "libname/helpers.scm" file from the current directory, which does not
> exist.
> 
> Conversations with leoprikler in IRC have revealed to me that
> call-with-include-port is the function responsible for this behavior
> <https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/psyntax.scm#n3231>.
> `syntax-source` returns a file path relative to the load path, and
> include tries to use that path to open a file relative to the current
> working directory.
> 
> In Guile's bug guidelines
> <https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Reporting-Bugs.html>,
> to me this fits
> 
> * Whenever documentation and actual behavior differ, you have certainly
>   found a bug, either in the documentation or in the program.
> 
> and potentially
> 
> * When some part of the documentation is not clear and does not make
>   sense to you even after re-reading the section, it is a bug.
> 
> I believe this is a bug, but I may be wrong, so emailing to clarify.
> Thank you!
> 
> Vijay Marupudi
> PhD Student in Human Centered-Computing
> Georgia Institute of Technology
> 
> 
> 
> 

-- 
Regards,
Bengt Richter




Information forwarded to bug-guile <at> gnu.org:
bug#49452; Package guile. (Thu, 08 Jul 2021 13:58:02 GMT) Full text and rfc822 format available.

Message #14 received at 49452 <at> debbugs.gnu.org (full text, mbox):

From: Vijay Marupudi <vijaymarupudi <at> gatech.edu>
To: Taylan Kammer <taylan.kammer <at> gmail.com>, 49452 <at> debbugs.gnu.org
Subject: Re: bug#49452: Confusing behavior with (include) used in file in
 GUILE_LOAD_PATH
Date: Thu, 8 Jul 2021 06:43:05 -0500
Thank you Taylan. This does appear to be the same bug. This bug can be
closed as a duplicate. Looks like Andy Wingo suggested a potential fix,
but there was no follow-up. If someone is willing to show me the ropes
when I need them, I can take a stab at learning the Guile codebase and
fixing the bug.

Vijay

On 7/7/21 3:29 AM, Taylan Kammer wrote:
> On 07.07.2021 02:31, Vijay Marupudi wrote:
>> Hello all,
>>
>> It is unclear to me what the intended behavior for (include
>> "filename.scm") is, so I'm sending an email about this potential bug.
>>
>> The Local Inclusion docs
>> <https://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html>
>> seem to state that relative paths are found relative to the file that
>> included them.
>>
>>> If file-name is a relative path, it is searched for relative to the
>>> path that contains the file that the include form appears in.
>>
>> So if I have a file "/libraries/libname/main.scm" than has (include
>> "./helpers.scm"), then the file "/libraries/libname/helpers.scm"
>> *should* (I think) be imported.
>>
>> But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
>> and my current working directory is somewhere else, say "/home/user" and
>> I'm running "/home/user/program.scm" that imports the (libname main)
>> library from "/libraries". Then Guile seems to try to include the
>> "libname/helpers.scm" file from the current directory, which does not
>> exist.
>>
>> Conversations with leoprikler in IRC have revealed to me that
>> call-with-include-port is the function responsible for this behavior
>> <https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/psyntax.scm#n3231>.
>> `syntax-source` returns a file path relative to the load path, and
>> include tries to use that path to open a file relative to the current
>> working directory.
>>
>> In Guile's bug guidelines
>> <https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Reporting-Bugs.html>,
>> to me this fits
>>
>> * Whenever documentation and actual behavior differ, you have certainly
>>   found a bug, either in the documentation or in the program.
>>
>> and potentially
>>
>> * When some part of the documentation is not clear and does not make
>>   sense to you even after re-reading the section, it is a bug.
>>
>> I believe this is a bug, but I may be wrong, so emailing to clarify.
>> Thank you!
>>
>> Vijay Marupudi
>> PhD Student in Human Centered-Computing
>> Georgia Institute of Technology
> 
> Hi Vijay,
> 
> I believe this is the same bug as this one I reported 5-6 years ago:
> 
> https://bugs.gnu.org/21613
> 
> Sadly there was no progress on it as far as I know.
> 




Information forwarded to bug-guile <at> gnu.org:
bug#49452; Package guile. (Fri, 09 Jul 2021 04:09:01 GMT) Full text and rfc822 format available.

Message #17 received at 49452 <at> debbugs.gnu.org (full text, mbox):

From: Vijay Marupudi <vijaymarupudi <at> gatech.edu>
To: Bengt Richter <bokr <at> bokr.com>
Cc: 49452 <at> debbugs.gnu.org
Subject: Re: bug#49452: Confusing behavior with (include) used in file in
 GUILE_LOAD_PATH
Date: Thu, 8 Jul 2021 23:08:12 -0500
Hello Bengt,

Unfortunately that still doesn't work :( I think they should be
considered the same though, when this bug gets fixed.

Vijay

On 7/7/21 4:22 PM, Bengt Richter wrote:
> Hi Vijay,
> 
> On +2021-07-06 19:31:38 -0500, Vijay Marupudi wrote:
>> Hello all,
>>
>> It is unclear to me what the intended behavior for (include
>> "filename.scm") is, so I'm sending an email about this potential bug.
>>
>> The Local Inclusion docs
>> <https://www.gnu.org/software/guile/manual/html_node/Local-Inclusion.html>
>> seem to state that relative paths are found relative to the file that
>> included them.
>>
>>> If file-name is a relative path, it is searched for relative to the
>>> path that contains the file that the include form appears in.
>>
>> So if I have a file "/libraries/libname/main.scm" than has (include
>> "./helpers.scm"), then the file "/libraries/libname/helpers.scm"
>> *should* (I think) be imported.
>>
> 
> A little nit, but
>     (include "filename.scm")
> is not identical to
>     (include "./filename.scm")
> so might it be worth trying
>    (include "helpers.scm")
> in your code?
> 
> And/or should the docs explain that both ways of writing a relative
> file name in this context are or are not acceptable?
> 
> Might some macro dislike leading dots?
> 
> Long shot ;-)
> 
>> But this does not seem to work if "/libraries" is in the GUILE_LOAD_PATH
>> and my current working directory is somewhere else, say "/home/user" and
>> I'm running "/home/user/program.scm" that imports the (libname main)
>> library from "/libraries". Then Guile seems to try to include the
>> "libname/helpers.scm" file from the current directory, which does not
>> exist.
>>
>> Conversations with leoprikler in IRC have revealed to me that
>> call-with-include-port is the function responsible for this behavior
>> <https://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/psyntax.scm#n3231>.
>> `syntax-source` returns a file path relative to the load path, and
>> include tries to use that path to open a file relative to the current
>> working directory.
>>
>> In Guile's bug guidelines
>> <https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Reporting-Bugs.html>,
>> to me this fits
>>
>> * Whenever documentation and actual behavior differ, you have certainly
>>   found a bug, either in the documentation or in the program.
>>
>> and potentially
>>
>> * When some part of the documentation is not clear and does not make
>>   sense to you even after re-reading the section, it is a bug.
>>
>> I believe this is a bug, but I may be wrong, so emailing to clarify.
>> Thank you!
>>
>> Vijay Marupudi
>> PhD Student in Human Centered-Computing
>> Georgia Institute of Technology
>>
>>
>>
>>
> 




Merged 21613 49452. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 23 Dec 2024 05:09:02 GMT) Full text and rfc822 format available.

Merged 21613 49452 70778. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 23 Dec 2024 05:11:02 GMT) Full text and rfc822 format available.

Merged 21613 49452 66046 70778. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 23 Dec 2024 05:11:03 GMT) Full text and rfc822 format available.

This bug report was last modified 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.