From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 8035@debbugs.gnu.org, slpnabble@blackberry-hill.com
Subject: bug#8035: Processing of .. in a file path after going thru symlink
Date: Thu, 26 Aug 2021 20:30:29 +0300 [thread overview]
Message-ID: <83k0k8ru4q.fsf@gnu.org> (raw)
In-Reply-To: <87czq0xgoj.fsf@gnus.org> (message from Lars Ingebrigtsen on Thu, 26 Aug 2021 19:24:28 +0200)
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: slpnabble@blackberry-hill.com, 8035@debbugs.gnu.org
> Date: Thu, 26 Aug 2021 19:24:28 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > expand-file-name also normalizes file names, though. Which is also
> > needed in some use cases, e.g. when the /foo/bar/ isn't accessible,
> > but /foo/ is, in which case failing to normalize /foo/bar/../quux
> > could fail some file I/O function.
>
> Hm, yes, that's a point...
The OP's use case is clearly documented in the ELisp manual:
Note also that ‘expand-file-name’ does not follow symbolic links at
any level. This results in a difference between the way
‘file-truename’ and ‘expand-file-name’ treat ‘..’. Assuming that
‘/tmp/bar’ is a symbolic link to the directory ‘/tmp/foo/bar’ we
get:
(file-truename "/tmp/bar/../myfile")
⇒ "/tmp/foo/myfile"
(expand-file-name "/tmp/bar/../myfile")
⇒ "/tmp/myfile"
If you may need to follow symbolic links preceding ‘..’, you should
make sure to call ‘file-truename’ without prior direct or indirect
calls to ‘expand-file-name’. *Note Truenames::.
So I think we need to use file-truename if we want to support such
uses of symlinks in "M-x compile" etc.
next prev parent reply other threads:[~2021-08-26 17:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 3:05 bug#8035: Processing of .. in a file path after going thru symlink spucci
2011-02-19 21:37 ` Glenn Morris
2011-02-20 2:35 ` Steve Pucci
2011-02-20 2:41 ` Steve Pucci
2021-08-26 16:29 ` Lars Ingebrigtsen
2021-08-26 16:44 ` Eli Zaretskii
2021-08-26 17:03 ` Lars Ingebrigtsen
2021-08-26 17:08 ` Eli Zaretskii
2021-08-26 17:24 ` Lars Ingebrigtsen
2021-08-26 17:30 ` Eli Zaretskii [this message]
2021-08-26 16:53 ` Andreas Schwab
2021-08-26 17:04 ` Lars Ingebrigtsen
2021-08-26 17:19 ` Andreas Schwab
2021-08-26 17:30 ` Lars Ingebrigtsen
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=83k0k8ru4q.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=8035@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=slpnabble@blackberry-hill.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 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.