On 12/11/20 5:03 AM, Adhemerval Zanella wrote:
I have sent a similar fix to reviews for this very issue for glibc
(which is based on the canonicalize-lgpl) along with other fixes that
you might take a look at [1].
Thanks, I looked at that when composing the patches I just now installed
into Gnulib, which also attempt to make future glibc merges easier. I think
these patches address the issues mentioned in [1] (though sometimes in
different ways), except they don't do what this patch does:
https://patchwork.sourceware.org/project/glibc/patch/20201027143531.2448132-4-adhemerval.zane...@linaro.org/
This patch seems incomplete, since it doesn't address the issue that
canonicalize_file_name ("/a/b/.") incorrectly returns "/a/b" even when /a/b
is a regular file.
Come to think of it, the current Gnulib is suboptimal in that it uses stat
("/a/b/foo/", ...) to test for the existence of a directory /a/b/foo. It
could use faccessat (AT_FDCWD, "/a/b/foo/", F_OK, AT_EACCESS), which is
often cheaper as it needn't fill in the stat structure.
I'll try to make time to look into these two issues, which are somewhat
related in the implementations of canonicalize-lgpl and canonicalize.