diff options
author | Karl Heuer <kwzh@gnu.org> | 1994-05-10 06:21:55 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1994-05-10 06:21:55 +0000 |
commit | f01de0db5ae7b1098ce8f74b10205a7fb754e9e8 (patch) | |
tree | c5701a04047681c7c15b1252a839d9bbfde35284 /lisp | |
parent | 76214250faa6c0a00f1f6afe64c4516babf87071 (diff) | |
download | emacs-f01de0db5ae7b1098ce8f74b10205a7fb754e9e8.tar.gz emacs-f01de0db5ae7b1098ce8f74b10205a7fb754e9e8.tar.bz2 emacs-f01de0db5ae7b1098ce8f74b10205a7fb754e9e8.zip |
(file-chase-links): Delete redundant slashes.
Match `..' only at start of string.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0a8aca1bd63..eacb4f01eaa 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -381,11 +381,15 @@ unlike `file-truename'." (while (setq tem (file-symlink-p newname)) (if (= count 0) (error "Apparent cycle of symbolic links for %s" filename)) + ;; In the context of a link, `//' doesn't mean what Emacs thinks. + (while (string-match "//+" tem) + (setq tem (concat (substring tem 0 (1+ (match-beginning 0))) + (substring tem (match-end 0))))) ;; Handle `..' by hand, since it needs to work in the ;; target of any directory symlink. ;; This code is not quite complete; it does not handle ;; embedded .. in some cases such as ./../foo and foo/bar/../../../lose. - (while (string-match "\\.\\./" tem) + (while (string-match "\\`\\.\\./" tem) (setq tem (substring tem 3)) (setq newname (file-name-as-directory ;; Do the .. by hand. |