all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Al Petrofsky <al@petrofsky.org>
Cc: jacob@teamconnectusa.com, eggert@cs.ucla.edu, larsi@gnus.org,
	64102@debbugs.gnu.org
Subject: bug#64102: 28.2; fails to find pathname with a sub dir as symlink and with parent dir ('..')
Date: Mon, 19 Jun 2023 22:03:14 +0300	[thread overview]
Message-ID: <83jzvz6zrh.fsf@gnu.org> (raw)
In-Reply-To: <CAPMQwz4nWyUYEOVfsSQn4jyp9DTiNzPwtQNo5+M=aUZ4A11uHw@mail.gmail.com> (message from Al Petrofsky on Sun, 18 Jun 2023 16:13:16 -0400)

> From: Al Petrofsky <al@petrofsky.org>
> Date: Sun, 18 Jun 2023 16:13:16 -0400
> 
> > My take from the description of the issue is that we'd need to change
> > expand-file-name to follow symlinks, i.e. hit the disk, something that
> > it never did, at least not on Posix platforms.  If this is what is
> > needed, it would have serious implications, at least performance-wise,
> > because expand-file-name is called everywhere in Emacs where we deal
> > with file names.
> 
> Perhaps another approach would be that Emacs continues to have its own
> idiosyncratic understanding of pathnames internally, but pathnames
> that come in from external sources are interpreted correctly according
> to the rules of the external environment.

This bug report is against what happens when visiting files given by
their name.  Emacs visits files in umpteen different ways, and they
all need to behave consistently.  Moreover, Emacs often visits files
or inserts their contents internally, for various processing purposes,
such, for example, processing of .mailalias files, save-place files,
etc.  If some of these features resolve symlinks in all the
directories, but others don't, this will be a source of constant user
surprise and complaints.

> That seems to be the approach that was taken by Lars in 2021 to fix
> bug 8035 (referenced by Jacob in the first message of the current
> bug).  See the patch that added file-truename calls to compile.el:
> 
>   
> http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/progmodes/compile.el?id=ee2ffd9c9eb33a17307f36ff58caec1ba79878d2

That changed a single place where using the resolved names solved a
particular problem in some internal processing step.  What is being
discussed here is a completely different, much more general problem.

> The current bug could similarly be fixed by making any filename that
> is obtained from the argv of emacs or emacsclient be passed through
> file-truename.

That's just two ways Emacs gets a file name that it is asked to visit.
It won't solve the following slight variation of the original report:

  emacs -q
  C-x C-f /tmp/lib2/gcc/x86_64-linux-gnu/12/../../../../include/test.h RET

> I don't know how much work that would be to implement,
> or how many user-confusing situations would remain and/or be created,
> but at least I don't see it being a performance problem, as the cost
> of an exec of emacs or emacsclient would likely dwarf the cost of the
> truename calls.

The performance problem will happen if we make expand-file-name
resolve all the symlinks.  That is the solution I had in mind, and
AFAIU it is the _only_ solution that will produce consistent results.

However, maybe I'm missing some clever alternative.  Which is why I
asked Paul to describe what he had in mind.  But solving it one case
at a time is definitely not TRT.





      reply	other threads:[~2023-06-19 19:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 22:25 bug#64102: 28.2; fails to find pathname with a sub dir as symlink and with parent dir ('..') Jacob Burckhardt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-16  7:11 ` Eli Zaretskii
2023-06-18  8:53   ` Eli Zaretskii
2023-06-18 18:03     ` Paul Eggert
2023-06-18 18:25       ` Eli Zaretskii
2023-06-18 18:43         ` Paul Eggert
2023-06-18 20:13 ` Al Petrofsky
2023-06-19 19:03   ` Eli Zaretskii [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83jzvz6zrh.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64102@debbugs.gnu.org \
    --cc=al@petrofsky.org \
    --cc=eggert@cs.ucla.edu \
    --cc=jacob@teamconnectusa.com \
    --cc=larsi@gnus.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.