Subject: Re: [PATCH v3] gexp: Make 'local-file' follow symlinks.

From: "pelzflorian (Florian Pelz)" <[email-masked]>
Date: Tue, 03 Sep 2024 17:05:44 +0200

Hello Nigko.

Nigko Yerden <[email-masked]> writes:
> This patch is the result of collective work of
> Florian Pelz <[email-masked]> and
> Nigko Yerden <[email-masked]>

Thanks for the credit, but it would be unusual to mention me in the
commit message, where discussion does not count.

Please do not put me in the commit message; I made no code contribution.

I also would favor to simplify `current-source-directory' and not add an
optional follow-symlinks? argument.  I believe processing profiles is
the only reasonable case that unconditionally following symlinks would
break, and people do not do profile processing in outside code.

> * tests/gexp.scm ("local-file, load through symlink"): New test.

This one is a good test; but it tests only half, namely the
rare-in-practice case of `local-file' when loading a Scheme file.  Here,
`current-source-directory' evaluate file-name to
"/tmp/guix-directory.VxrxZT/dir/link-to-code.scm", which has a slash as
prefix, so absolute-dirname is not called.

The original issue is that the package in a channel according to
cookbook’s “The Repository as a Channel” cannot be built when the
load-path is set up in the usual way.  There, absolute-dirname gets
called.  I think we would need a (very similar) test that covers this.

Instead of primitive-load, we would need to invoke Guile on a file in a
channel or in the GUILE_LOAD_PATH, or set %load-path.  I may be wrong
here and do not know how, but we definitely should cover when
`file-name' in is not prefixed with a slash.

Regards,
Florian