GNU bug report logs -
#72867
[PATCH] gexp: Make 'local-file' follow symlinks.
Previous Next
Full log
View this message in rfc822 format
Hello Nigko, Tobias, Ludo, Attila (putting them in Cc again).
Nigko Yerden <nigko.yerden <at> 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
This bug report was last modified 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.