GNU bug report logs -
#77122
[PATCH] project--find-in-directory resolves symlinks
Previous Next
Full log
View this message in rfc822 format
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Wed, 19 Mar 2025 12:55:09 -0400
>
> This avoids duplicate projects accessed via symlinks that share resolved directory locations. This has
> bothered me for a while, so here we go.
>
> From 074905ff365c6bcd7cbcf72e0158ae9db0908a20 Mon Sep 17 00:00:00 2001
> From: shipmints <shipmints <at> gmail.com>
> Date: Wed, 19 Mar 2025 12:50:28 -0400
> Subject: [PATCH] project--find-in-directory resolves symlinks (bug#xxx)
>
> This avoids duplicate projects that share resolved directory locations.
>
> * lisp/progmodes/project.el (project--find-in-directory): Invoke
> 'project-find-functions' on 'file-truename' resolved dir.
> ---
> lisp/progmodes/project.el | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 4eac541167a..45f5328f6be 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -251,6 +251,10 @@ project-current
> pr))
>
> (defun project--find-in-directory (dir)
> + "Invoke `project-find-functions' for DIR.
> +DIR is resolved to its true name, 'chasing' symbolic links, to avoid
> +duplicate projects that share resolved directory locations."
> + (setq dir (file-truename dir))
That's not necessarily what the user will want, since it changes the
name of the file (and potentially its directory as well). If the file
or the directory have some "magical" name that matters, this will
backfire.
I think it is better to detect the fact that two directories point to
the same place via symlinks (e.g., with file-equal-p), and avoid
duplication in that case, but without actually substituting the file's
name by its truename.
But of course the final word is for Dmitry.
This bug report was last modified 109 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.