aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2018-05-26 14:29:06 +0200
committerMichael Albinus2018-05-26 14:29:06 +0200
commit8083c2de699cad2fc3cea51480011605fab56484 (patch)
treef9a424064b5af1a8bf65fc404cf0e2e680fcc77c
parent91bf38cef5f9e3d73f3b69200ddf46a5b76779af (diff)
downloademacs-8083c2de699cad2fc3cea51480011605fab56484.tar.gz
emacs-8083c2de699cad2fc3cea51480011605fab56484.zip
Make `tramp-make-tramp-file-name' calls consistent.
* lisp/net/tramp.el (tramp-get-buffer) (tramp-handle-file-name-as-directory) (tramp-handle-file-name-directory, tramp-handle-file-remote-p) (tramp-handle-file-truename, tramp-handle-find-backup-file-name) (tramp-handle-insert-file-contents): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name) (tramp-gvfs-get-remote-uid, tramp-gvfs-get-remote-gid) (tramp-gvfs-maybe-open-connection): * lisp/net/tramp-sh.el (tramp-sh-handle-file-truename) (tramp-sh-handle-expand-file-name, ) (tramp-sh-handle-process-file, tramp-get-remote-path): * lisp/net/tramp-smb.el (tramp-smb-handle-expand-file-name) (tramp-smb-handle-process-file): Make `tramp-make-tramp-file-name' calls consistent.
-rw-r--r--lisp/net/tramp-gvfs.el39
-rw-r--r--lisp/net/tramp-sh.el26
-rw-r--r--lisp/net/tramp-smb.el6
-rw-r--r--lisp/net/tramp.el42
4 files changed, 48 insertions, 65 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index ac250818aca..f547f84a17e 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1054,8 +1054,7 @@ file names."
1054 ;; No tilde characters in file name, do normal 1054 ;; No tilde characters in file name, do normal
1055 ;; `expand-file-name' (this does "/./" and "/../"). 1055 ;; `expand-file-name' (this does "/./" and "/../").
1056 (tramp-make-tramp-file-name 1056 (tramp-make-tramp-file-name
1057 method user domain host port 1057 v (tramp-run-real-handler 'expand-file-name (list localname))))))
1058 (tramp-run-real-handler 'expand-file-name (list localname))))))
1059 1058
1060(defun tramp-gvfs-get-directory-attributes (directory) 1059(defun tramp-gvfs-get-directory-attributes (directory)
1061 "Return GVFS attributes association list of all files in DIRECTORY." 1060 "Return GVFS attributes association list of all files in DIRECTORY."
@@ -1885,20 +1884,15 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
1885 "The uid of the remote connection VEC, in ID-FORMAT. 1884 "The uid of the remote connection VEC, in ID-FORMAT.
1886ID-FORMAT valid values are `string' and `integer'." 1885ID-FORMAT valid values are `string' and `integer'."
1887 (with-tramp-connection-property vec (format "uid-%s" id-format) 1886 (with-tramp-connection-property vec (format "uid-%s" id-format)
1888 (let ((method (tramp-file-name-method vec)) 1887 (let ((user (tramp-file-name-user vec))
1889 (user (tramp-file-name-user vec))
1890 (domain (tramp-file-name-domain vec))
1891 (host (tramp-file-name-host vec))
1892 (port (tramp-file-name-port vec))
1893 (localname 1888 (localname
1894 (tramp-get-connection-property vec "default-location" nil))) 1889 (tramp-get-connection-property vec "default-location" nil)))
1895 (cond 1890 (cond
1896 ((and user (equal id-format 'string)) user) 1891 ((and (equal id-format 'string) user))
1897 (localname 1892 (localname
1898 (tramp-compat-file-attribute-user-id 1893 (tramp-compat-file-attribute-user-id
1899 (file-attributes 1894 (file-attributes
1900 (tramp-make-tramp-file-name method user domain host port localname) 1895 (tramp-make-tramp-file-name vec localname) id-format)))
1901 id-format)))
1902 ((equal id-format 'integer) tramp-unknown-id-integer) 1896 ((equal id-format 'integer) tramp-unknown-id-integer)
1903 ((equal id-format 'string) tramp-unknown-id-string))))) 1897 ((equal id-format 'string) tramp-unknown-id-string)))))
1904 1898
@@ -1906,19 +1900,13 @@ ID-FORMAT valid values are `string' and `integer'."
1906 "The gid of the remote connection VEC, in ID-FORMAT. 1900 "The gid of the remote connection VEC, in ID-FORMAT.
1907ID-FORMAT valid values are `string' and `integer'." 1901ID-FORMAT valid values are `string' and `integer'."
1908 (with-tramp-connection-property vec (format "gid-%s" id-format) 1902 (with-tramp-connection-property vec (format "gid-%s" id-format)
1909 (let ((method (tramp-file-name-method vec)) 1903 (let ((localname
1910 (user (tramp-file-name-user vec))
1911 (domain (tramp-file-name-domain vec))
1912 (host (tramp-file-name-host vec))
1913 (port (tramp-file-name-port vec))
1914 (localname
1915 (tramp-get-connection-property vec "default-location" nil))) 1904 (tramp-get-connection-property vec "default-location" nil)))
1916 (cond 1905 (cond
1917 (localname 1906 (localname
1918 (tramp-compat-file-attribute-group-id 1907 (tramp-compat-file-attribute-group-id
1919 (file-attributes 1908 (file-attributes
1920 (tramp-make-tramp-file-name method user domain host port localname) 1909 (tramp-make-tramp-file-name vec localname) id-format)))
1921 id-format)))
1922 ((equal id-format 'integer) tramp-unknown-id-integer) 1910 ((equal id-format 'integer) tramp-unknown-id-integer)
1923 ((equal id-format 'string) tramp-unknown-id-string))))) 1911 ((equal id-format 'string) tramp-unknown-id-string)))))
1924 1912
@@ -1960,15 +1948,12 @@ connection if a previous connection has died for some reason."
1960 (set-process-query-on-exit-flag p nil))) 1948 (set-process-query-on-exit-flag p nil)))
1961 1949
1962 (unless (tramp-gvfs-connection-mounted-p vec) 1950 (unless (tramp-gvfs-connection-mounted-p vec)
1963 (let* ((method (tramp-file-name-method vec)) 1951 (let ((method (tramp-file-name-method vec))
1964 (user (tramp-file-name-user vec)) 1952 (user (tramp-file-name-user vec))
1965 (domain (tramp-file-name-domain vec)) 1953 (host (tramp-file-name-host vec))
1966 (host (tramp-file-name-host vec)) 1954 (localname (tramp-file-name-unquote-localname vec))
1967 (port (tramp-file-name-port vec)) 1955 (object-path
1968 (localname (tramp-file-name-unquote-localname vec)) 1956 (tramp-gvfs-object-path (tramp-make-tramp-file-name vec 'noloc))))
1969 (object-path
1970 (tramp-gvfs-object-path
1971 (tramp-make-tramp-file-name method user domain host port ""))))
1972 1957
1973 (when (and (string-equal method "afp") 1958 (when (and (string-equal method "afp")
1974 (string-equal localname "/")) 1959 (string-equal localname "/"))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 227fd9c356d..76dae9cea5e 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1125,7 +1125,7 @@ component is used as the target of the symlink."
1125 'file-name-as-directory 'identity) 1125 'file-name-as-directory 'identity)
1126 (with-parsed-tramp-file-name (expand-file-name filename) nil 1126 (with-parsed-tramp-file-name (expand-file-name filename) nil
1127 (tramp-make-tramp-file-name 1127 (tramp-make-tramp-file-name
1128 method user domain host port 1128 v
1129 (with-tramp-file-property v localname "file-truename" 1129 (with-tramp-file-property v localname "file-truename"
1130 (let ((result nil) ; result steps in reverse order 1130 (let ((result nil) ; result steps in reverse order
1131 (quoted (tramp-compat-file-name-quoted-p localname)) 1131 (quoted (tramp-compat-file-name-quoted-p localname))
@@ -1177,12 +1177,13 @@ component is used as the target of the symlink."
1177 (tramp-compat-file-attribute-type 1177 (tramp-compat-file-attribute-type
1178 (file-attributes 1178 (file-attributes
1179 (tramp-make-tramp-file-name 1179 (tramp-make-tramp-file-name
1180 method user domain host port 1180 v
1181 (mapconcat 'identity 1181 (mapconcat 'identity
1182 (append '("") 1182 (append '("")
1183 (reverse result) 1183 (reverse result)
1184 (list thisstep)) 1184 (list thisstep))
1185 "/"))))) 1185 "/")
1186 'nohop))))
1186 (cond ((string= "." thisstep) 1187 (cond ((string= "." thisstep)
1187 (tramp-message v 5 "Ignoring step `.'")) 1188 (tramp-message v 5 "Ignoring step `.'"))
1188 ((string= ".." thisstep) 1189 ((string= ".." thisstep)
@@ -1226,7 +1227,8 @@ component is used as the target of the symlink."
1226 (let (file-name-handler-alist) 1227 (let (file-name-handler-alist)
1227 (setq result (tramp-compat-file-name-quote result)))) 1228 (setq result (tramp-compat-file-name-quote result))))
1228 (tramp-message v 4 "True name of `%s' is `%s'" localname result) 1229 (tramp-message v 4 "True name of `%s' is `%s'" localname result)
1229 result)))))) 1230 result))
1231 'nohop))))
1230 1232
1231;; Basic functions. 1233;; Basic functions.
1232 1234
@@ -2804,11 +2806,9 @@ the result will be a local, non-Tramp, file name."
2804 ;; be problems with UNC shares or Cygwin mounts. 2806 ;; be problems with UNC shares or Cygwin mounts.
2805 (let ((default-directory (tramp-compat-temporary-file-directory))) 2807 (let ((default-directory (tramp-compat-temporary-file-directory)))
2806 (tramp-make-tramp-file-name 2808 (tramp-make-tramp-file-name
2807 method user domain host port 2809 v (tramp-drop-volume-letter
2808 (tramp-drop-volume-letter 2810 (tramp-run-real-handler
2809 (tramp-run-real-handler 2811 'expand-file-name (list localname))))))))
2810 'expand-file-name (list localname)))
2811 hop)))))
2812 2812
2813;;; Remote commands: 2813;;; Remote commands:
2814 2814
@@ -2997,8 +2997,7 @@ the result will be a local, non-Tramp, file name."
2997 (setq input (with-parsed-tramp-file-name infile nil localname)) 2997 (setq input (with-parsed-tramp-file-name infile nil localname))
2998 ;; INFILE must be copied to remote host. 2998 ;; INFILE must be copied to remote host.
2999 (setq input (tramp-make-tramp-temp-file v) 2999 (setq input (tramp-make-tramp-temp-file v)
3000 tmpinput 3000 tmpinput (tramp-make-tramp-file-name v input 'nohop))
3001 (tramp-make-tramp-file-name method user domain host port input))
3002 (copy-file infile tmpinput t))) 3001 (copy-file infile tmpinput t)))
3003 (when input (setq command (format "%s <%s" command input))) 3002 (when input (setq command (format "%s <%s" command input)))
3004 3003
@@ -3031,8 +3030,7 @@ the result will be a local, non-Tramp, file name."
3031 ;; stderr must be copied to remote host. The temporary 3030 ;; stderr must be copied to remote host. The temporary
3032 ;; file must be deleted after execution. 3031 ;; file must be deleted after execution.
3033 (setq stderr (tramp-make-tramp-temp-file v) 3032 (setq stderr (tramp-make-tramp-temp-file v)
3034 tmpstderr (tramp-make-tramp-file-name 3033 tmpstderr (tramp-make-tramp-file-name v stderr 'nohop))))
3035 method user domain host port stderr))))
3036 ;; stderr to be discarded. 3034 ;; stderr to be discarded.
3037 ((null (cadr destination)) 3035 ((null (cadr destination))
3038 (setq stderr "/dev/null")))) 3036 (setq stderr "/dev/null"))))
@@ -5294,7 +5292,7 @@ Nonexistent directories are removed from spec."
5294 (lambda (x) 5292 (lambda (x)
5295 (and 5293 (and
5296 (stringp x) 5294 (stringp x)
5297 (file-directory-p (tramp-make-tramp-file-name vec x)) 5295 (file-directory-p (tramp-make-tramp-file-name vec x 'nohop))
5298 x)) 5296 x))
5299 remote-path))))) 5297 remote-path)))))
5300 5298
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index c2df2e21bcb..0334f052a07 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -715,8 +715,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
715 ;; No tilde characters in file name, do normal 715 ;; No tilde characters in file name, do normal
716 ;; `expand-file-name' (this does "/./" and "/../"). 716 ;; `expand-file-name' (this does "/./" and "/../").
717 (tramp-make-tramp-file-name 717 (tramp-make-tramp-file-name
718 method user domain host port 718 v (tramp-run-real-handler 'expand-file-name (list localname))))))
719 (tramp-run-real-handler 'expand-file-name (list localname))))))
720 719
721(defun tramp-smb-action-get-acl (proc vec) 720(defun tramp-smb-action-get-acl (proc vec)
722 "Read ACL data from connection buffer." 721 "Read ACL data from connection buffer."
@@ -1235,8 +1234,7 @@ component is used as the target of the symlink."
1235 (setq input (with-parsed-tramp-file-name infile nil localname)) 1234 (setq input (with-parsed-tramp-file-name infile nil localname))
1236 ;; INFILE must be copied to remote host. 1235 ;; INFILE must be copied to remote host.
1237 (setq input (tramp-make-tramp-temp-file v) 1236 (setq input (tramp-make-tramp-temp-file v)
1238 tmpinput 1237 tmpinput (tramp-make-tramp-file-name v input))
1239 (tramp-make-tramp-file-name method user domain host port input))
1240 (copy-file infile tmpinput t)) 1238 (copy-file infile tmpinput t))
1241 ;; Transform input into a filename powershell does understand. 1239 ;; Transform input into a filename powershell does understand.
1242 (setq input (format "//%s%s" host input))) 1240 (setq input (format "//%s%s" host input)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 398372883b3..1d6e0146c4d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1462,7 +1462,7 @@ necessary only. This function will be used in file name completion."
1462 vec "process-buffer" 1462 vec "process-buffer"
1463 (tramp-get-connection-property vec "process-buffer" nil)) 1463 (tramp-get-connection-property vec "process-buffer" nil))
1464 (setq buffer-undo-list t 1464 (setq buffer-undo-list t
1465 default-directory (tramp-make-tramp-file-name vec "/" 'nohop)) 1465 default-directory (tramp-make-tramp-file-name vec 'noloc 'nohop))
1466 (current-buffer)))) 1466 (current-buffer))))
1467 1467
1468(defun tramp-get-connection-buffer (vec) 1468(defun tramp-get-connection-buffer (vec)
@@ -3072,11 +3072,11 @@ User is always nil."
3072 ;; Run the command on the localname portion only unless we are in 3072 ;; Run the command on the localname portion only unless we are in
3073 ;; completion mode. 3073 ;; completion mode.
3074 (tramp-make-tramp-file-name 3074 (tramp-make-tramp-file-name
3075 v (unless (and (zerop (length (tramp-file-name-localname v))) 3075 v (or (and (zerop (length (tramp-file-name-localname v)))
3076 (not (tramp-connectable-p file))) 3076 (not (tramp-connectable-p file)))
3077 (tramp-run-real-handler 3077 (tramp-run-real-handler
3078 'file-name-as-directory 3078 'file-name-as-directory
3079 (list (or (tramp-file-name-localname v) ""))))))) 3079 (list (tramp-file-name-localname v)))))))
3080 3080
3081(defun tramp-handle-file-name-case-insensitive-p (filename) 3081(defun tramp-handle-file-name-case-insensitive-p (filename)
3082 "Like `file-name-case-insensitive-p' for Tramp files." 3082 "Like `file-name-case-insensitive-p' for Tramp files."
@@ -3153,11 +3153,16 @@ User is always nil."
3153 3153
3154(defun tramp-handle-file-name-directory (file) 3154(defun tramp-handle-file-name-directory (file)
3155 "Like `file-name-directory' but aware of Tramp files." 3155 "Like `file-name-directory' but aware of Tramp files."
3156 (with-parsed-tramp-file-name file nil 3156 ;; Everything except the last filename thing is the directory. We
3157 (setf (tramp-file-name-localname v) nil) 3157 ;; cannot apply `with-parsed-tramp-file-name', because this expands
3158 ;; Run the command on the localname portion only. 3158 ;; the remote file name parts.
3159 (let ((v (tramp-dissect-file-name file t)))
3160 ;; Run the command on the localname portion only. If this returns
3161 ;; nil, mark also the localname part of `v' as nil.
3159 (tramp-make-tramp-file-name 3162 (tramp-make-tramp-file-name
3160 v (tramp-run-real-handler'file-name-directory (list localname))))) 3163 v (or (tramp-run-real-handler
3164 'file-name-directory (list (tramp-file-name-localname v)))
3165 'noloc))))
3161 3166
3162(defun tramp-handle-file-name-nondirectory (file) 3167(defun tramp-handle-file-name-nondirectory (file)
3163 "Like `file-name-nondirectory' but aware of Tramp files." 3168 "Like `file-name-nondirectory' but aware of Tramp files."
@@ -3202,8 +3207,7 @@ User is always nil."
3202 ((eq identification 'host) (tramp-file-name-host-port v)) 3207 ((eq identification 'host) (tramp-file-name-host-port v))
3203 ((eq identification 'localname) localname) 3208 ((eq identification 'localname) localname)
3204 ((eq identification 'hop) hop) 3209 ((eq identification 'hop) hop)
3205 (t (tramp-make-tramp-file-name 3210 (t (tramp-make-tramp-file-name v 'noloc)))))))))
3206 method user domain host port "" hop)))))))))
3207 3211
3208(defun tramp-handle-file-selinux-context (_filename) 3212(defun tramp-handle-file-selinux-context (_filename)
3209 "Like `file-selinux-context' for Tramp files." 3213 "Like `file-selinux-context' for Tramp files."
@@ -3237,7 +3241,7 @@ User is always nil."
3237 result 3241 result
3238 (with-parsed-tramp-file-name (expand-file-name result) v2 3242 (with-parsed-tramp-file-name (expand-file-name result) v2
3239 (tramp-make-tramp-file-name 3243 (tramp-make-tramp-file-name
3240 v2-method v2-user v2-domain v2-host v2-port 3244 v2
3241 (funcall 3245 (funcall
3242 (if (tramp-compat-file-name-quoted-p v2-localname) 3246 (if (tramp-compat-file-name-quoted-p v2-localname)
3243 'tramp-compat-file-name-quote 'identity) 3247 'tramp-compat-file-name-quote 'identity)
@@ -3248,7 +3252,8 @@ User is always nil."
3248 (tramp-compat-file-name-quote symlink-target)) 3252 (tramp-compat-file-name-quote symlink-target))
3249 (expand-file-name 3253 (expand-file-name
3250 symlink-target (file-name-directory v2-localname))) 3254 symlink-target (file-name-directory v2-localname)))
3251 v2-localname))))) 3255 v2-localname))
3256 'nohop)))
3252 (when (>= numchase numchase-limit) 3257 (when (>= numchase numchase-limit)
3253 (tramp-error 3258 (tramp-error
3254 v1 'file-error 3259 v1 'file-error
@@ -3267,8 +3272,7 @@ User is always nil."
3267 (if (and (stringp (cdr x)) 3272 (if (and (stringp (cdr x))
3268 (file-name-absolute-p (cdr x)) 3273 (file-name-absolute-p (cdr x))
3269 (not (tramp-tramp-file-p (cdr x)))) 3274 (not (tramp-tramp-file-p (cdr x))))
3270 (tramp-make-tramp-file-name 3275 (tramp-make-tramp-file-name v (cdr x))
3271 method user domain host port (cdr x) hop)
3272 (cdr x)))) 3276 (cdr x))))
3273 tramp-backup-directory-alist) 3277 tramp-backup-directory-alist)
3274 backup-directory-alist))) 3278 backup-directory-alist)))
@@ -3373,7 +3377,7 @@ User is always nil."
3373 ((stringp remote-copy) 3377 ((stringp remote-copy)
3374 (file-local-copy 3378 (file-local-copy
3375 (tramp-make-tramp-file-name 3379 (tramp-make-tramp-file-name
3376 method user domain host port remote-copy))) 3380 v remote-copy 'nohop)))
3377 ((stringp tramp-temp-buffer-file-name) 3381 ((stringp tramp-temp-buffer-file-name)
3378 (copy-file 3382 (copy-file
3379 filename tramp-temp-buffer-file-name 'ok) 3383 filename tramp-temp-buffer-file-name 'ok)
@@ -3417,9 +3421,7 @@ User is always nil."
3417 (or remote-copy (null tramp-temp-buffer-file-name))) 3421 (or remote-copy (null tramp-temp-buffer-file-name)))
3418 (delete-file local-copy)) 3422 (delete-file local-copy))
3419 (when (stringp remote-copy) 3423 (when (stringp remote-copy)
3420 (delete-file 3424 (delete-file (tramp-make-tramp-file-name v remote-copy 'nohop)))))
3421 (tramp-make-tramp-file-name
3422 method user domain host port remote-copy)))))
3423 3425
3424 ;; Result. 3426 ;; Result.
3425 (list (expand-file-name filename) 3427 (list (expand-file-name filename)