bugGuile - Bugs: bug #30480, VM: load looks for files in the...

 
 

bug #30480: VM: load looks for files in the wrong directory

Submitted by:  Luca Saiu <positrone>
Submitted on:  Sun 18 Jul 2010 10:51:53 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 13 Feb 2011 06:51:23 PM UTC, comment #4:

Fixed, by turning load into a macro that expands to a call to load-in-vicinity. Nasty or awesome? We report, you decide!

Andy Wingo <wingo>
Project Administrator
Sat 24 Jul 2010 04:16:08 PM UTC, comment #3:

For the record, this was initially discussed at http://thread.gmane.org/gmane.lisp.guile.bugs/4359 .

Ludo'.

Ludovic Courtès <civodul>
Project Administrator
Sun 18 Jul 2010 10:59:50 PM UTC, comment #2:

Sorry again, I must be tired: there was no reason for me to suppose that load changed the current directory.

Please ignore my previous comment.

Luca Saiu <positrone>
Sun 18 Jul 2010 10:54:59 PM UTC, comment #1:

I've written "I don't know if at startup time or at load time". Mmm. Since the problem exists, I strongly suspect it's at startup time. Sorry for the noise.

Luca Saiu <positrone>
Sun 18 Jul 2010 10:51:53 PM UTC, original submission:

The behavior of the load function in bytecode programs is wrong and different from interpreted programs.

  • The interpreter works just like 1.8 did: loaded files are looked for in paths relative to the directory of the script calling load. This is the reasonable and useful behavior.
  • The virtual machine looks for the file to load in paths relative to the cwd (I don't know if at startup time or at load time).

Absolute pathnames work in either case.

Ludovic said this when we spoke about that in Göteborg:
load should call canonicalize-path relative to the directory of the file which loads the other one, not relative to `pwd`.

Of course this is a regression compared to 1.8.

How to reproduce the malfunction, in a particularly simple case (no explicit relative paths in the pathnames given to load):
$ cd /tmp; mkdir q; echo '(display "b\n")' > q/b.scm; echo '(load "b.scm")(display "a\n")' > q/a.scm
$ rm -rf ~/.cache
$ guile --no-autocompile q/a.scm
b
a
$ guile --autocompile q/a.scm
;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-autocompile argument to disable.
;;; compiling q/a.scm
;;; compiled /home/luca/.cache/guile/ccache/2.0-0.Q-LE-8/tmp/q/a.scm.go
ERROR: In procedure open-file:
ERROR: No such file or directory: "b.scm"

Luca Saiu <positrone>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wingo (Posted a comment)
  • -unavailable- added by civodul (Posted a comment)
  • -unavailable- added by positrone (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 13 Feb 2011 06:51:23 PM UTCwingoStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1