From: Steve Pucci <spucci@mac.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 8035@debbugs.gnu.org
Subject: bug#8035: Processing of .. in a file path after going thru symlink
Date: Sat, 19 Feb 2011 18:35:35 -0800 [thread overview]
Message-ID: <C18D35F8-1104-4696-AD72-EC1476E0477F@mac.com> (raw)
In-Reply-To: <00lj1bd7ty.fsf@fencepost.gnu.org>
On Feb 19, 2011, at 1:37 PM, Glenn Morris wrote:
> This appears to be a feature of expand-file-name (and possibly other
> things). It does seem a little weird that there isn't even an option to
> have a more thorough expansion...
So I ran an experiment, redefining expand-file-name as follows to skip the ".." processing (except in default-directory) and otherwise do the rest:
(or (fboundp 'save-expand-file-name)
(fset 'save-expand-file-name (symbol-function 'expand-file-name)))
(defun expand-file-name (NAME &optional DEFAULT-DIRECTORY)
(cond ((string-match "^/" NAME)
NAME)
((string-match "^\\(~[^/]*\\)\\(.*\\)$" NAME)
(let ((userdir (match-string 1 NAME))
(rest (match-string 2 NAME)))
(concat (save-expand-file-name userdir) rest)))
(t (concat (save-expand-file-name (if DEFAULT-DIRECTORY
DEFAULT-DIRECTORY
default-directory))
NAME))))
While this does the trick (it expands only ~ and relative paths and properly leaves the OP path intact), it fails to fix the problem with next-error. So I conclude you're right there are other places that do the same thing, apparently.
My workaround now is to wrap my build script in a Perl script which rewrites all "../" paths it finds within its output. So I'm ok, though I'm surprised this hasn't come up before...
next prev parent reply other threads:[~2011-02-20 2:35 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 [this message]
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
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=C18D35F8-1104-4696-AD72-EC1476E0477F@mac.com \
--to=spucci@mac.com \
--cc=8035@debbugs.gnu.org \
--cc=rgm@gnu.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.