From: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
To: Nigko Yerden <nigko.yerden@gmail.com>
Cc: "Tobias Geerinckx-Rice" <me@tobias.gr>,
"Ludovic Courtès" <ludo@gnu.org>,
72867@debbugs.gnu.org, "Attila Lendvai" <attila@lendvai.name>
Subject: [bug#72867] [PATCH v5] gexp: Make 'local-file' follow symlinks.
Date: Sat, 07 Sep 2024 09:35:54 +0200 [thread overview]
Message-ID: <87r09vsyp1.fsf@pelzflorian.de> (raw)
In-Reply-To: <6e87ddd086b9188539eecfc83bdd6712aaf53a1a.1725596262.git.nigko.yerden@gmail.com> (Nigko Yerden's message of "Fri, 6 Sep 2024 09:17:42 +0500")
Hello Nigko, Tobias, Ludo, Attila (putting them in Cc again).
Nigko Yerden <nigko.yerden@gmail.com> writes:
> Using of 'eval' in test from v4 is wrong. It does not play any role there.
> Most importantly it does not prevent spoiling of '%load-path' for the
> rest of 'tests/gexp.scm' module. Here is the better version of the test
> that uses 'dynamic-wind'.
The test is beautiful. It makes clear why each
canonicalize-path is needed. I had not understood the issue entirely
before I read it.
When we follow symlinks, both calling the real "../test-local-file.scm"
and the symlink to it behaves the same.
When not following symlinks, we get different results depending on what
we run. I see no reason to ever want that except displaying info or
debugging.
And except that not following symlinks is faster (fewer stat syscalls).
But Ludovic wrapped absolute-dirname in a memoizing mlambda in commit
87b711d200ad13eaef284bdd1ab77f85618b0498, which reduces the difference.
Regarding the code, if we kept the old code when `follow-symlinks?' is
false (we should not, but if we did), it remains surprising that we do
follow some symlinks.
> + (if follow-symlinks?
> + (dirname (canonicalize-path file))
> + ;; If there are relative names in %LOAD-PATH, FILE can be relative
> + ;; and needs to be canonicalized.
> + (if (string-prefix? "/" file)
> + (dirname file)
> + (canonicalize-path (dirname file))))))))
In the new use-modules part of the test, `file-name'
in `current-source-directory' is "./test-local-file.scm" code, which
means if we look at what happens if we not follow-symlinks, we took the
latter (canonicalize-path (dirname file)) path in
> (if (string-prefix? "/" file)
> (dirname file)
> (canonicalize-path (dirname file))))))))
which does not follow the symlink in the basename and fails.
But it would follow symlinks in the directory part.
Regards,
Florian
next prev parent reply other threads:[~2024-09-07 7:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 6:06 [bug#72867] [PATCH] gexp: Make 'local-file' follow symlinks Nigko Yerden
2024-08-29 7:01 ` [bug#72867] when should local-file and current-source-directory not follow symlinks? Attila Lendvai
2024-08-29 9:00 ` [bug#72867] [PATCH] gexp: Make 'local-file' follow symlinks Ludovic Courtès
2024-08-29 10:10 ` pelzflorian (Florian Pelz)
2024-08-30 12:07 ` Nigko Yerden
2024-08-30 14:00 ` [bug#72867] when should local-file and current-source-directory not follow symlinks? Nigko Yerden
2024-08-31 17:10 ` pelzflorian (Florian Pelz)
2024-09-01 14:13 ` Tobias Geerinckx-Rice via Guix-patches via
2024-09-02 4:41 ` [bug#72867] [PATCH v2] gexp: Make 'local-file' follow symlinks Nigko Yerden
2024-09-02 7:53 ` [bug#72867] [PATCH v3] " Nigko Yerden
2024-09-03 15:05 ` pelzflorian (Florian Pelz)
2024-09-05 5:06 ` Nigko Yerden
2024-09-05 4:16 ` [bug#72867] [PATCH v4] " Nigko Yerden
2024-09-06 4:17 ` [bug#72867] [PATCH v5] " Nigko Yerden
2024-09-07 7:35 ` pelzflorian (Florian Pelz) [this message]
2024-09-25 5:16 ` pelzflorian (Florian Pelz)
2024-09-26 7:07 ` [bug#72867] [PATCH v6] " Nigko Yerden via Guix-patches
2024-10-02 16:15 ` Ludovic Courtès
2024-10-03 13:22 ` pelzflorian (Florian Pelz)
2024-10-06 7:09 ` pelzflorian (Florian Pelz)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r09vsyp1.fsf@pelzflorian.de \
--to=pelzflorian@pelzflorian.de \
--cc=72867@debbugs.gnu.org \
--cc=attila@lendvai.name \
--cc=ludo@gnu.org \
--cc=me@tobias.gr \
--cc=nigko.yerden@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).