Closed lassik closed 3 months ago
Given a file bug.scm with the contents:
bug.scm
(import (scheme base) (scheme write) (srfi 193) (chibi filesystem)) (change-directory "/") ; <-- This line causes the bug. (write (script-file)) (newline)
Running chibi-scheme bug.scm outputs "/bug.scm".
chibi-scheme bug.scm
"/bug.scm"
That's because raw-script-file is not resolved from a relative to an absolute pathname until (script-file) is called.
raw-script-file
(script-file)
What would be a good place to resolve it? The relative pathname is set in main.c.
main.c
The easiest way to fix this is to record the PWD in (srfi 193) on loading, however in pathological cases (dynamic loading of SRFI 193 after changing directory) that fails. So we probably need to resolve in main.c.
Given a file
bug.scm
with the contents:Running
chibi-scheme bug.scm
outputs"/bug.scm"
.That's because
raw-script-file
is not resolved from a relative to an absolute pathname until(script-file)
is called.What would be a good place to resolve it? The relative pathname is set in
main.c
.