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

 
 

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

Submitter:  Luca Saiu <positrone>
Submitted:  Sun 18 Jul 2010 10:51:53 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-02-13 wingo StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code