Hello Florian,

pelzflorian (Florian Pelz) wrote:
While processing guile-package.scm,

(search-path %load-path "guile-package.scm")

returns an absolute path if and only if guile-package.scm is in the
load-path, like when using it from a channel.  Then, your diff makes it
resolve symlinks.
That's right.

If the configuration or package file is not in the load-path,
guile-package.scm is returned, absolute-dirname’s other `if' branch
calls `canonicalize-path' on all but the basename and directory symlinks
already got resolved.
No, in this case 'search-path' returns #f. But if 'syntax-source' gives
absolute path, then 'current-source-directory' returns 'dirname' of this
path without calling 'absolute-dirname'.

Indeed with weird load-paths

GUILE_LOAD_PATH=${GUILE_LOAD_PATH}:/home/florian/src/home-config/configs guix 
home reconfigure gnu.scm

;;; 
("/gnu/store/nanvziq36krgh330yjhwpphcyfz5dyzm-guix-module-union/share/guile/site/3.0")

because syntax-source says filename is
"gnu.scm".

But not normally

GUILE_LOAD_PATH=${GUILE_LOAD_PATH} guix home reconfigure gnu.scm
;;; ("/home/florian/src/home-config/configs")

because syntax-source says filename is
"/home/florian/src/home-config/configs/gnu.scm".
This observation shows that 'current-source-directory' is really bad because
'syntax-source' is bad. Sometimes 'syntax-source' gives an absolute path, and
sometimes a relative one, and I don't understand under what conditions.
And '(module-filename (current-module))' does not seem to be better.
In my experiments it gives exactly the same filename as 'syntax-source'.
But this bad behavior of 'current-source-directory' is unrelated to symlinks and
'if' condition in 'absolute-dirname'. All Guile load paths I have seen before 
are
absolute paths, and the second branch of 'if' is not executed for them.

Maybe we should leave 'absolute-dirname' alone, as well as 
'current-source-directory',
and consider 'local-file' more closely.

Regards,
Nigko

Reply via email to