diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/files.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 18 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el index 7754be29643..8cec3d45dce 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1165,7 +1165,8 @@ directory name and leading `~' and `/:' are not special in FILE." | |||
| 1165 | (if (eq (find-file-name-handler dirname 'file-symlink-p) | 1165 | (if (eq (find-file-name-handler dirname 'file-symlink-p) |
| 1166 | (find-file-name-handler file 'file-symlink-p)) | 1166 | (find-file-name-handler file 'file-symlink-p)) |
| 1167 | file | 1167 | file |
| 1168 | (file-name-quote file)) | 1168 | ;; If `file' is remote, we want to quote it at the beginning. |
| 1169 | (let (file-name-handler-alist) (file-name-quote file))) | ||
| 1169 | (concat dirname file))) | 1170 | (concat dirname file))) |
| 1170 | 1171 | ||
| 1171 | (defun file-truename (filename &optional counter prev-dirs) | 1172 | (defun file-truename (filename &optional counter prev-dirs) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6494b0957bf..85966f122d2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1086,7 +1086,7 @@ component is used as the target of the symlink." | |||
| 1086 | ;; If TARGET is a Tramp name, use just the localname component. | 1086 | ;; If TARGET is a Tramp name, use just the localname component. |
| 1087 | (when (and (tramp-tramp-file-p target) | 1087 | (when (and (tramp-tramp-file-p target) |
| 1088 | (tramp-file-name-equal-p | 1088 | (tramp-file-name-equal-p |
| 1089 | v (tramp-dissect-file-name (expand-file-name target)))) | 1089 | v (tramp-dissect-file-name target))) |
| 1090 | (setq target | 1090 | (setq target |
| 1091 | (tramp-file-name-localname | 1091 | (tramp-file-name-localname |
| 1092 | (tramp-dissect-file-name (expand-file-name target))))) | 1092 | (tramp-dissect-file-name (expand-file-name target))))) |
| @@ -1132,7 +1132,12 @@ component is used as the target of the symlink." | |||
| 1132 | (tramp-shell-quote-argument localname))) | 1132 | (tramp-shell-quote-argument localname))) |
| 1133 | (with-current-buffer (tramp-get-connection-buffer v) | 1133 | (with-current-buffer (tramp-get-connection-buffer v) |
| 1134 | (goto-char (point-min)) | 1134 | (goto-char (point-min)) |
| 1135 | (setq result (buffer-substring (point-min) (point-at-eol))))) | 1135 | (setq result (buffer-substring (point-min) (point-at-eol)))) |
| 1136 | (when (and (file-symlink-p filename) | ||
| 1137 | (string-equal result localname)) | ||
| 1138 | (tramp-error | ||
| 1139 | v 'file-error | ||
| 1140 | "Apparent cycle of symbolic links for %s" filename))) | ||
| 1136 | 1141 | ||
| 1137 | ;; Use Perl implementation. | 1142 | ;; Use Perl implementation. |
| 1138 | ((and (tramp-get-remote-perl v) | 1143 | ((and (tramp-get-remote-perl v) |
| @@ -1214,8 +1219,11 @@ component is used as the target of the symlink." | |||
| 1214 | "/")) | 1219 | "/")) |
| 1215 | (when (string= "" result) | 1220 | (when (string= "" result) |
| 1216 | (setq result "/"))))) | 1221 | (setq result "/"))))) |
| 1217 | 1222 | ;; If the resulting localname looks remote, we must quote it | |
| 1218 | (when quoted (setq result (tramp-compat-file-name-quote result))) | 1223 | ;; for security reasons. |
| 1224 | (when (or quoted (file-remote-p result)) | ||
| 1225 | (let (file-name-handler-alist) | ||
| 1226 | (setq result (tramp-compat-file-name-quote result)))) | ||
| 1219 | (tramp-message v 4 "True name of `%s' is `%s'" localname result) | 1227 | (tramp-message v 4 "True name of `%s' is `%s'" localname result) |
| 1220 | result)))) | 1228 | result)))) |
| 1221 | 1229 | ||
| @@ -3072,7 +3080,7 @@ the result will be a local, non-Tramp, file name." | |||
| 3072 | (defun tramp-sh-handle-file-local-copy (filename) | 3080 | (defun tramp-sh-handle-file-local-copy (filename) |
| 3073 | "Like `file-local-copy' for Tramp files." | 3081 | "Like `file-local-copy' for Tramp files." |
| 3074 | (with-parsed-tramp-file-name filename nil | 3082 | (with-parsed-tramp-file-name filename nil |
| 3075 | (unless (file-exists-p filename) | 3083 | (unless (file-exists-p (file-truename filename)) |
| 3076 | (tramp-error | 3084 | (tramp-error |
| 3077 | v tramp-file-missing | 3085 | v tramp-file-missing |
| 3078 | "Cannot make local copy of non-existing file `%s'" filename)) | 3086 | "Cannot make local copy of non-existing file `%s'" filename)) |