aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-05-10 06:21:55 +0000
committerKarl Heuer1994-05-10 06:21:55 +0000
commitf01de0db5ae7b1098ce8f74b10205a7fb754e9e8 (patch)
treec5701a04047681c7c15b1252a839d9bbfde35284
parent76214250faa6c0a00f1f6afe64c4516babf87071 (diff)
downloademacs-f01de0db5ae7b1098ce8f74b10205a7fb754e9e8.tar.gz
emacs-f01de0db5ae7b1098ce8f74b10205a7fb754e9e8.zip
(file-chase-links): Delete redundant slashes.
Match `..' only at start of string.
-rw-r--r--lisp/files.el6
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'."
381 (while (setq tem (file-symlink-p newname)) 381 (while (setq tem (file-symlink-p newname))
382 (if (= count 0) 382 (if (= count 0)
383 (error "Apparent cycle of symbolic links for %s" filename)) 383 (error "Apparent cycle of symbolic links for %s" filename))
384 ;; In the context of a link, `//' doesn't mean what Emacs thinks.
385 (while (string-match "//+" tem)
386 (setq tem (concat (substring tem 0 (1+ (match-beginning 0)))
387 (substring tem (match-end 0)))))
384 ;; Handle `..' by hand, since it needs to work in the 388 ;; Handle `..' by hand, since it needs to work in the
385 ;; target of any directory symlink. 389 ;; target of any directory symlink.
386 ;; This code is not quite complete; it does not handle 390 ;; This code is not quite complete; it does not handle
387 ;; embedded .. in some cases such as ./../foo and foo/bar/../../../lose. 391 ;; embedded .. in some cases such as ./../foo and foo/bar/../../../lose.
388 (while (string-match "\\.\\./" tem) 392 (while (string-match "\\`\\.\\./" tem)
389 (setq tem (substring tem 3)) 393 (setq tem (substring tem 3))
390 (setq newname (file-name-as-directory 394 (setq newname (file-name-as-directory
391 ;; Do the .. by hand. 395 ;; Do the .. by hand.