unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Guile 1.9: bug in load
@ 2009-11-13 20:24 Luca Saiu
  2009-11-16 19:23 ` Andy Wingo
  0 siblings, 1 reply; 12+ messages in thread
From: Luca Saiu @ 2009-11-13 20:24 UTC (permalink / raw)
  To: bug-guile

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello people.
We've found a little bug in 1.9:

load should call canonicalize-path relative to the directory of the file
which loads the other one, not relative to `pwd`.

Thanks and greeting from the GHM.

- --
Luca Saiu
http://www-lipn.univ-paris13.fr/~saiu
GNU epsilon: http://www.gnu.org/software/epsilon
Marionnet:   http://www.marionnet.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkr9wIkACgkQvzOavibF0oZQwQCfZ8v+xLC/RAli8j7gq3r2YhlZ
OzUAnjKYHsfBz0Dyn5WljoUD5egpeLJL
=QNjO
-----END PGP SIGNATURE-----





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-13 20:24 Guile 1.9: bug in load Luca Saiu
@ 2009-11-16 19:23 ` Andy Wingo
  2009-11-18  5:16   ` Thien-Thi Nguyen
  2009-11-18 10:05   ` Luca Saiu
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Wingo @ 2009-11-16 19:23 UTC (permalink / raw)
  To: Luca Saiu; +Cc: bug-guile

Hi Luca :-)

On Fri 13 Nov 2009 21:24, Luca Saiu <positron@gnu.org> writes:

> load should call canonicalize-path relative to the directory of the file
> which loads the other one, not relative to `pwd`.

Has this changed since 1.8? AFAIK no -- but do correct me if I'm wrong
-- and so for that reason, I don't think it's possible to change it --
for backwards-compatibility reasons.

However the use case is important. We need to implement a (current-file)
macro, I think, which should allow for file-relative loads.

> Thanks and greeting from the GHM.

Greetings to you!

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-16 19:23 ` Andy Wingo
@ 2009-11-18  5:16   ` Thien-Thi Nguyen
  2009-11-18 21:03     ` Andy Wingo
  2009-11-18 10:05   ` Luca Saiu
  1 sibling, 1 reply; 12+ messages in thread
From: Thien-Thi Nguyen @ 2009-11-18  5:16 UTC (permalink / raw)
  To: bug-guile

() Andy Wingo <wingo@pobox.com>
() Mon, 16 Nov 2009 20:23:07 +0100

   However the use case is important. We need to implement a (current-file)
   macro, I think, which should allow for file-relative loads.

Is `current-load-port' still around for official Guile?
If so,

(define (current-file)
  (port-filename (current-load-port)))

might be sufficient.

thi




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-16 19:23 ` Andy Wingo
  2009-11-18  5:16   ` Thien-Thi Nguyen
@ 2009-11-18 10:05   ` Luca Saiu
  2009-11-18 20:57     ` Andy Wingo
                       ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Luca Saiu @ 2009-11-18 10:05 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andy Wingo wrote:
> Hi Luca :-)
> 
> On Fri 13 Nov 2009 21:24, Luca Saiu <positron@gnu.org> writes:
> 
>> load should call canonicalize-path relative to the directory of the file
>> which loads the other one, not relative to `pwd`.
> 
> Has this changed since 1.8?

Yes, it has changed. I had originally developed my little game with
Guile 1.8, on which it works (apart from the lockup problem I had hinted
at, but that's totally unrelated and may be a bug in my code) and the
problem only shows up when testing with 1.9. Ludovic was following me
when I've tested at dinner; so the report should be reliable even if I
had a couple of beers :-).

> AFAIK no -- but do correct me if I'm wrong
> -- and so for that reason, I don't think it's possible to change it --
> for backwards-compatibility reasons.

So I think that it *should* be changed for backwards-compatibility
reasons, but also because the behavior in 1.8 is clearly the right thing.

> However the use case is important. We need to implement a (current-file)
> macro, I think, which should allow for file-relative loads.

If you need a distilled test case, please tell me; it should be quite
easy to build.

> Greetings to you!

It's really been a pleasure to meet you and Ludovic face to face.
My greetings to Neil, too.

- --
Luca Saiu
http://www-lipn.univ-paris13.fr/~saiu
GNU epsilon: http://www.gnu.org/software/epsilon
Marionnet:   http://www.marionnet.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksDxv0ACgkQvzOavibF0oYGwACfekkOSSN7vzNeeSt5NnnlZHsW
KB8AniNOFf/n8x+AwFkwVJr0GDH1bJLH
=VZub
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18 10:05   ` Luca Saiu
@ 2009-11-18 20:57     ` Andy Wingo
  2010-03-26 13:02       ` Luca Saiu
  2009-11-19  0:29     ` Ludovic Courtès
  2009-11-19 22:53     ` Neil Jerram
  2 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2009-11-18 20:57 UTC (permalink / raw)
  To: Luca Saiu; +Cc: bug-guile

On Wed 18 Nov 2009 11:05, Luca Saiu <positron@gnu.org> writes:

> Andy Wingo wrote:
>> On Fri 13 Nov 2009 21:24, Luca Saiu <positron@gnu.org> writes:
>> 
>>> load should call canonicalize-path relative to the directory of the file
>>> which loads the other one, not relative to `pwd`.
>> 
>> Has this changed since 1.8?
>
> Yes, it has changed.

OK, then we have to fix it then :)

> If you need a distilled test case, please tell me; it should be quite
> easy to build.

No, it's a fairly easy thing to reproduce. Please poke us if we haven't
fixed it within a couple weeks.

Happy hacking,

Andy
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18  5:16   ` Thien-Thi Nguyen
@ 2009-11-18 21:03     ` Andy Wingo
  2009-11-19  0:14       ` Ludovic Courtès
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2009-11-18 21:03 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: bug-guile

Hi Thien-Thi,

On Wed 18 Nov 2009 06:16, Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> () Andy Wingo <wingo@pobox.com>
> () Mon, 16 Nov 2009 20:23:07 +0100
>
>    However the use case is important. We need to implement a (current-file)
>    macro, I think, which should allow for file-relative loads.
>
> Is `current-load-port' still around for official Guile?

Yes.

> If so,
>
> (define (current-file)
>   (port-filename (current-load-port)))
>
> might be sufficient.

It would probably have to be a macro, as the code that is actually
loaded is bytecode -- the port has been closed already.

This might work:

(define-syntax current-file
  (lambda (x)
    (syntax-case x ()
      ((_) (datum->syntax x (and=> (current-load-port) port-filename))))))

But we need the compiler to munge the current load port, which is
currently does not. A bug.

A
-- 
http://wingolog.org/




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18 21:03     ` Andy Wingo
@ 2009-11-19  0:14       ` Ludovic Courtès
  0 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2009-11-19  0:14 UTC (permalink / raw)
  To: bug-guile

Andy Wingo <wingo@pobox.com> writes:

> Hi Thien-Thi,
>
> On Wed 18 Nov 2009 06:16, Thien-Thi Nguyen <ttn@gnuvola.org> writes:
>
>> () Andy Wingo <wingo@pobox.com>
>> () Mon, 16 Nov 2009 20:23:07 +0100
>>
>>    However the use case is important. We need to implement a (current-file)
>>    macro, I think, which should allow for file-relative loads.
>>
>> Is `current-load-port' still around for official Guile?
>
> Yes.

Actually, not 100%: it’s not honored by ‘load-compiled’.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18 10:05   ` Luca Saiu
  2009-11-18 20:57     ` Andy Wingo
@ 2009-11-19  0:29     ` Ludovic Courtès
  2009-11-19 22:53     ` Neil Jerram
  2 siblings, 0 replies; 12+ messages in thread
From: Ludovic Courtès @ 2009-11-19  0:29 UTC (permalink / raw)
  To: bug-guile

Hi Luca!

I actually looked into it on my trip back from Göteborg, in the hope of
fixing it for 1.9.5, in vain.  I did reproduce the problem with
‘DIR/a.scm’ and ‘DIR/b/c.scm’ where ‘c.scm’ contains ‘(load "../a.scm")’.

I first tried to fix it by having ‘load’ prepend the directory name of
the file that is calling ‘load’ (hereafter the “loader”) to the path
passed to ‘load’ when it’s a relative path.

To do that, ‘load-compiled’ must be changed to honor
‘current-load-port’, so that we can get the path of the loader in there.
Unfortunately, that doesn’t work: autocompiled files live in a different
place than the corresponding .scm files, so at this point the original
file system context is lost.  Perhaps a different mechanism could be
thought of to propagate the source file path associated with the current
load port.

Another solution would be to special-case calls to ‘load’ at
compile-time to replace its argument by an absolute path.  However,
that’d be inelegant, especially since one could well ‘(set! load foo)’
at run-time.

Yet another solution would be to turn ‘load’ into an expansion-time
thing, but R5RS says it’s a procedure.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18 10:05   ` Luca Saiu
  2009-11-18 20:57     ` Andy Wingo
  2009-11-19  0:29     ` Ludovic Courtès
@ 2009-11-19 22:53     ` Neil Jerram
  2 siblings, 0 replies; 12+ messages in thread
From: Neil Jerram @ 2009-11-19 22:53 UTC (permalink / raw)
  To: Luca Saiu; +Cc: bug-guile

Luca Saiu <positron@gnu.org> writes:

> It's really been a pleasure to meet you and Ludovic face to face.
> My greetings to Neil, too.

Thanks Luca.  It sounds like you all had a really great meeting; I'm
sorry I missed it!

Regards,
        Neil




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2009-11-18 20:57     ` Andy Wingo
@ 2010-03-26 13:02       ` Luca Saiu
  2010-07-17 10:59         ` Andy Wingo
  0 siblings, 1 reply; 12+ messages in thread
From: Luca Saiu @ 2010-03-26 13:02 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello again.

Andy, you had asked me to ping you if the problem was still there after
some time. I still see it in 1.9.9.

Thanks to you and the whole team for your great work,

Andy Wingo wrote:
> On Wed 18 Nov 2009 11:05, Luca Saiu <positron@gnu.org> writes:
> 
>> Andy Wingo wrote:
>>> On Fri 13 Nov 2009 21:24, Luca Saiu <positron@gnu.org> writes:
>>>
>>>> load should call canonicalize-path relative to the directory of the file
>>>> which loads the other one, not relative to `pwd`.
>>> Has this changed since 1.8?
>> Yes, it has changed.
> 
> OK, then we have to fix it then :)
> 
>> If you need a distilled test case, please tell me; it should be quite
>> easy to build.
> 
> No, it's a fairly easy thing to reproduce. Please poke us if we haven't
> fixed it within a couple weeks.
> 
> Happy hacking,
> 
> Andy


- --
Luca Saiu
http://www-lipn.univ-paris13.fr/~saiu
GNU epsilon: http://www.gnu.org/software/epsilon
Marionnet:   http://www.marionnet.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkussIEACgkQvzOavibF0oaKKwCeKSKe09Z7z8BfEtOJA29rhw5L
2OUAn3+pQFgmaCB/9OuD2gTeUNVPFBBc
=grFt
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2010-03-26 13:02       ` Luca Saiu
@ 2010-07-17 10:59         ` Andy Wingo
  2010-07-18 22:54           ` Luca Saiu
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Wingo @ 2010-07-17 10:59 UTC (permalink / raw)
  To: Luca Saiu; +Cc: bug-guile

Hi Luca,

Can you file a bug for this?

  https://savannah.gnu.org/bugs/?group=guile

I didn't see an obvious solution at the start, and so I forgot about it;
but we should have an answer for it. Collecting the info in a place
other than my inbox would be a great start :)

Thanks!

Andy

On Fri 26 Mar 2010 14:02, Luca Saiu <positron@gnu.org> writes:

> Hello again.
>
> Andy, you had asked me to ping you if the problem was still there after
> some time. I still see it in 1.9.9.
>
> Thanks to you and the whole team for your great work,
>
> Andy Wingo wrote:
>> On Wed 18 Nov 2009 11:05, Luca Saiu <positron@gnu.org> writes:
>> 
>>> Andy Wingo wrote:
>>>> On Fri 13 Nov 2009 21:24, Luca Saiu <positron@gnu.org> writes:
>>>>
>>>>> load should call canonicalize-path relative to the directory of the file
>>>>> which loads the other one, not relative to `pwd`.
>>>> Has this changed since 1.8?
>>> Yes, it has changed.
>> 
>> OK, then we have to fix it then :)
>> 
>>> If you need a distilled test case, please tell me; it should be quite
>>> easy to build.
>> 
>> No, it's a fairly easy thing to reproduce. Please poke us if we haven't
>> fixed it within a couple weeks.
>> 
>> Happy hacking,
>> 
>> Andy
>
>
> --
> Luca Saiu
> http://www-lipn.univ-paris13.fr/~saiu
> GNU epsilon: http://www.gnu.org/software/epsilon
> Marionnet:   http://www.marionnet.org

-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Guile 1.9: bug in load
  2010-07-17 10:59         ` Andy Wingo
@ 2010-07-18 22:54           ` Luca Saiu
  0 siblings, 0 replies; 12+ messages in thread
From: Luca Saiu @ 2010-07-18 22:54 UTC (permalink / raw)
  To: Andy Wingo; +Cc: bug-guile

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello.

Andy Wingo wrote:
> Hi Luca,
> 
> Can you file a bug for this?

Sure.  It's bug #30480.
Thanks,

- --
Luca Saiu
http://www-lipn.univ-paris13.fr/~saiu
GNU epsilon: http://www.gnu.org/software/epsilon
Marionnet:   http://www.marionnet.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkxDhhoACgkQvzOavibF0obyvwCeO58sLjzrcbVk4nhSM9M+Cfu0
ADkAn2g91Dl5A7JHxNeVdTO7pz6tg/w6
=EB9h
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-07-18 22:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 20:24 Guile 1.9: bug in load Luca Saiu
2009-11-16 19:23 ` Andy Wingo
2009-11-18  5:16   ` Thien-Thi Nguyen
2009-11-18 21:03     ` Andy Wingo
2009-11-19  0:14       ` Ludovic Courtès
2009-11-18 10:05   ` Luca Saiu
2009-11-18 20:57     ` Andy Wingo
2010-03-26 13:02       ` Luca Saiu
2010-07-17 10:59         ` Andy Wingo
2010-07-18 22:54           ` Luca Saiu
2009-11-19  0:29     ` Ludovic Courtès
2009-11-19 22:53     ` Neil Jerram

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).