aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2019-06-23 18:58:11 +0200
committerMichael Albinus2019-06-23 18:58:11 +0200
commit383a557b537562ceed38da3c9a07790c2f6b67f6 (patch)
treec894ce3d18f8112edd321da80e4fd180c4311aa8
parenta1deb6cac305a73e799c63e2fbfe7221790e1e61 (diff)
downloademacs-383a557b537562ceed38da3c9a07790c2f6b67f6.tar.gz
emacs-383a557b537562ceed38da3c9a07790c2f6b67f6.zip
Improve error handling in tramp-gvfs
* lisp/net/tramp-gvfs.el (tramp-gvfs-get-directory-attributes) (tramp-gvfs-get-root-attributes) (tramp-gvfs-handle-file-attributes): Don't ignore errors. (tramp-make-goa-name): New defun. (tramp-gvfs-get-remote-prefix): Use it. (tramp-gvfs-maybe-open-connection): Raise user errors in case of. Check also, that GOA accounts are proper. (tramp-get-goa-accounts): Cache connection property. * lisp/net/tramp.el (tramp-handle-file-equal-p) (tramp-handle-file-in-directory-p): Use `tramp-equal-remote'.
-rw-r--r--lisp/net/tramp-gvfs.el486
-rw-r--r--lisp/net/tramp.el10
2 files changed, 253 insertions, 243 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 17c2e79833b..cee7a1209bd 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -933,76 +933,74 @@ file names."
933 933
934(defun tramp-gvfs-get-directory-attributes (directory) 934(defun tramp-gvfs-get-directory-attributes (directory)
935 "Return GVFS attributes association list of all files in DIRECTORY." 935 "Return GVFS attributes association list of all files in DIRECTORY."
936 (ignore-errors 936 ;; Don't modify `last-coding-system-used' by accident.
937 ;; Don't modify `last-coding-system-used' by accident. 937 (let ((last-coding-system-used last-coding-system-used)
938 (let ((last-coding-system-used last-coding-system-used) 938 result)
939 result) 939 (with-parsed-tramp-file-name directory nil
940 (with-parsed-tramp-file-name directory nil 940 (with-tramp-file-property v localname "directory-attributes"
941 (with-tramp-file-property v localname "directory-attributes" 941 (tramp-message v 5 "directory gvfs attributes: %s" localname)
942 (tramp-message v 5 "directory gvfs attributes: %s" localname) 942 ;; Send command.
943 ;; Send command. 943 (tramp-gvfs-send-command
944 (tramp-gvfs-send-command 944 v "gvfs-ls" "-h" "-n" "-a"
945 v "gvfs-ls" "-h" "-n" "-a" 945 (mapconcat #'identity tramp-gvfs-file-attributes ",")
946 (mapconcat #'identity tramp-gvfs-file-attributes ",") 946 (tramp-gvfs-url-file-name directory))
947 (tramp-gvfs-url-file-name directory)) 947 ;; Parse output.
948 ;; Parse output. 948 (with-current-buffer (tramp-get-connection-buffer v)
949 (with-current-buffer (tramp-get-connection-buffer v) 949 (goto-char (point-min))
950 (goto-char (point-min)) 950 (while (looking-at
951 (while (looking-at 951 (concat "^\\(.+\\)[[:blank:]]"
952 (concat "^\\(.+\\)[[:blank:]]" 952 "\\([[:digit:]]+\\)[[:blank:]]"
953 "\\([[:digit:]]+\\)[[:blank:]]" 953 "(\\(.+?\\))"
954 "(\\(.+?\\))" 954 tramp-gvfs-file-attributes-with-gvfs-ls-regexp))
955 tramp-gvfs-file-attributes-with-gvfs-ls-regexp)) 955 (let ((item (list (cons "type" (match-string 3))
956 (let ((item (list (cons "type" (match-string 3)) 956 (cons "standard::size" (match-string 2))
957 (cons "standard::size" (match-string 2)) 957 (cons "name" (match-string 1)))))
958 (cons "name" (match-string 1))))) 958 (goto-char (1+ (match-end 3)))
959 (goto-char (1+ (match-end 3))) 959 (while (looking-at
960 (while (looking-at 960 (concat
961 (concat 961 tramp-gvfs-file-attributes-with-gvfs-ls-regexp
962 tramp-gvfs-file-attributes-with-gvfs-ls-regexp 962 "\\(" tramp-gvfs-file-attributes-with-gvfs-ls-regexp
963 "\\(" tramp-gvfs-file-attributes-with-gvfs-ls-regexp 963 "\\|" "$" "\\)"))
964 "\\|" "$" "\\)")) 964 (push (cons (match-string 1) (match-string 2)) item)
965 (push (cons (match-string 1) (match-string 2)) item) 965 (goto-char (match-end 2)))
966 (goto-char (match-end 2))) 966 ;; Add display name as head.
967 ;; Add display name as head. 967 (push
968 (push 968 (cons (cdr (or (assoc "standard::display-name" item)
969 (cons (cdr (or (assoc "standard::display-name" item) 969 (assoc "name" item)))
970 (assoc "name" item))) 970 (nreverse item))
971 (nreverse item)) 971 result))
972 result)) 972 (forward-line)))
973 (forward-line))) 973 result))))
974 result)))))
975 974
976(defun tramp-gvfs-get-root-attributes (filename &optional file-system) 975(defun tramp-gvfs-get-root-attributes (filename &optional file-system)
977 "Return GVFS attributes association list of FILENAME. 976 "Return GVFS attributes association list of FILENAME.
978If FILE-SYSTEM is non-nil, return file system attributes." 977If FILE-SYSTEM is non-nil, return file system attributes."
979 (ignore-errors 978 ;; Don't modify `last-coding-system-used' by accident.
980 ;; Don't modify `last-coding-system-used' by accident. 979 (let ((last-coding-system-used last-coding-system-used)
981 (let ((last-coding-system-used last-coding-system-used) 980 result)
982 result) 981 (with-parsed-tramp-file-name filename nil
983 (with-parsed-tramp-file-name filename nil 982 (with-tramp-file-property
984 (with-tramp-file-property 983 v localname
985 v localname 984 (if file-system "file-system-attributes" "file-attributes")
986 (if file-system "file-system-attributes" "file-attributes") 985 (tramp-message
987 (tramp-message 986 v 5 "file%s gvfs attributes: %s"
988 v 5 "file%s gvfs attributes: %s" 987 (if file-system " system" "") localname)
989 (if file-system " system" "") localname) 988 ;; Send command.
990 ;; Send command. 989 (if file-system
991 (if file-system
992 (tramp-gvfs-send-command
993 v "gvfs-info" "--filesystem" (tramp-gvfs-url-file-name filename))
994 (tramp-gvfs-send-command 990 (tramp-gvfs-send-command
995 v "gvfs-info" (tramp-gvfs-url-file-name filename))) 991 v "gvfs-info" "--filesystem" (tramp-gvfs-url-file-name filename))
996 ;; Parse output. 992 (tramp-gvfs-send-command
997 (with-current-buffer (tramp-get-connection-buffer v) 993 v "gvfs-info" (tramp-gvfs-url-file-name filename)))
998 (goto-char (point-min)) 994 ;; Parse output.
999 (while (re-search-forward 995 (with-current-buffer (tramp-get-connection-buffer v)
1000 (if file-system 996 (goto-char (point-min))
1001 tramp-gvfs-file-system-attributes-regexp 997 (while (re-search-forward
1002 tramp-gvfs-file-attributes-with-gvfs-info-regexp) 998 (if file-system
1003 nil t) 999 tramp-gvfs-file-system-attributes-regexp
1004 (push (cons (match-string 1) (match-string 2)) result)) 1000 tramp-gvfs-file-attributes-with-gvfs-info-regexp)
1005 result)))))) 1001 nil t)
1002 (push (cons (match-string 1) (match-string 2)) result))
1003 result)))))
1006 1004
1007(defun tramp-gvfs-get-file-attributes (filename) 1005(defun tramp-gvfs-get-file-attributes (filename)
1008 "Return GVFS attributes association list of FILENAME." 1006 "Return GVFS attributes association list of FILENAME."
@@ -1020,123 +1018,122 @@ If FILE-SYSTEM is non-nil, return file system attributes."
1020(defun tramp-gvfs-handle-file-attributes (filename &optional id-format) 1018(defun tramp-gvfs-handle-file-attributes (filename &optional id-format)
1021 "Like `file-attributes' for Tramp files." 1019 "Like `file-attributes' for Tramp files."
1022 (unless id-format (setq id-format 'integer)) 1020 (unless id-format (setq id-format 'integer))
1023 (ignore-errors 1021 (let ((attributes (tramp-gvfs-get-file-attributes filename))
1024 (let ((attributes (tramp-gvfs-get-file-attributes filename)) 1022 dirp res-symlink-target res-numlinks res-uid res-gid res-access
1025 dirp res-symlink-target res-numlinks res-uid res-gid res-access 1023 res-mod res-change res-size res-filemodes res-inode res-device)
1026 res-mod res-change res-size res-filemodes res-inode res-device) 1024 (when attributes
1027 (when attributes 1025 ;; ... directory or symlink
1028 ;; ... directory or symlink 1026 (setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t))
1029 (setq dirp (if (equal "directory" (cdr (assoc "type" attributes))) t)) 1027 (setq res-symlink-target
1028 (cdr (assoc "standard::symlink-target" attributes)))
1029 (when (stringp res-symlink-target)
1030 (setq res-symlink-target 1030 (setq res-symlink-target
1031 (cdr (assoc "standard::symlink-target" attributes))) 1031 ;; Parse unibyte codes "\xNN". We assume they are
1032 (when (stringp res-symlink-target) 1032 ;; non-ASCII codepoints in the range #x80 through #xff.
1033 (setq res-symlink-target 1033 ;; Convert them to multibyte.
1034 ;; Parse unibyte codes "\xNN". We assume they are 1034 (decode-coding-string
1035 ;; non-ASCII codepoints in the range #x80 through #xff. 1035 (replace-regexp-in-string
1036 ;; Convert them to multibyte. 1036 "\\\\x\\([[:xdigit:]]\\{2\\}\\)"
1037 (decode-coding-string 1037 (lambda (x)
1038 (replace-regexp-in-string 1038 (unibyte-string (string-to-number (match-string 1 x) 16)))
1039 "\\\\x\\([[:xdigit:]]\\{2\\}\\)" 1039 res-symlink-target)
1040 (lambda (x) 1040 'utf-8)))
1041 (unibyte-string (string-to-number (match-string 1 x) 16))) 1041 ;; ... number links
1042 res-symlink-target) 1042 (setq res-numlinks
1043 'utf-8))) 1043 (string-to-number
1044 ;; ... number links 1044 (or (cdr (assoc "unix::nlink" attributes)) "0")))
1045 (setq res-numlinks 1045 ;; ... uid and gid
1046 (string-to-number 1046 (setq res-uid
1047 (or (cdr (assoc "unix::nlink" attributes)) "0"))) 1047 (if (eq id-format 'integer)
1048 ;; ... uid and gid 1048 (string-to-number
1049 (setq res-uid 1049 (or (cdr (assoc "unix::uid" attributes))
1050 (if (eq id-format 'integer) 1050 (eval-when-compile
1051 (string-to-number 1051 (format "%s" tramp-unknown-id-integer))))
1052 (or (cdr (assoc "unix::uid" attributes)) 1052 (or (cdr (assoc "owner::user" attributes))
1053 (eval-when-compile 1053 (cdr (assoc "unix::uid" attributes))
1054 (format "%s" tramp-unknown-id-integer)))) 1054 tramp-unknown-id-string)))
1055 (or (cdr (assoc "owner::user" attributes)) 1055 (setq res-gid
1056 (cdr (assoc "unix::uid" attributes)) 1056 (if (eq id-format 'integer)
1057 tramp-unknown-id-string))) 1057 (string-to-number
1058 (setq res-gid 1058 (or (cdr (assoc "unix::gid" attributes))
1059 (if (eq id-format 'integer) 1059 (eval-when-compile
1060 (string-to-number 1060 (format "%s" tramp-unknown-id-integer))))
1061 (or (cdr (assoc "unix::gid" attributes)) 1061 (or (cdr (assoc "owner::group" attributes))
1062 (eval-when-compile 1062 (cdr (assoc "unix::gid" attributes))
1063 (format "%s" tramp-unknown-id-integer)))) 1063 tramp-unknown-id-string)))
1064 (or (cdr (assoc "owner::group" attributes)) 1064 ;; ... last access, modification and change time
1065 (cdr (assoc "unix::gid" attributes)) 1065 (setq res-access
1066 tramp-unknown-id-string))) 1066 (seconds-to-time
1067 ;; ... last access, modification and change time 1067 (string-to-number
1068 (setq res-access 1068 (or (cdr (assoc "time::access" attributes)) "0"))))
1069 (seconds-to-time 1069 (setq res-mod
1070 (string-to-number 1070 (seconds-to-time
1071 (or (cdr (assoc "time::access" attributes)) "0")))) 1071 (string-to-number
1072 (setq res-mod 1072 (or (cdr (assoc "time::modified" attributes)) "0"))))
1073 (seconds-to-time 1073 (setq res-change
1074 (string-to-number 1074 (seconds-to-time
1075 (or (cdr (assoc "time::modified" attributes)) "0")))) 1075 (string-to-number
1076 (setq res-change 1076 (or (cdr (assoc "time::changed" attributes)) "0"))))
1077 (seconds-to-time 1077 ;; ... size
1078 (string-to-number 1078 (setq res-size
1079 (or (cdr (assoc "time::changed" attributes)) "0")))) 1079 (string-to-number
1080 ;; ... size 1080 (or (cdr (assoc "standard::size" attributes)) "0")))
1081 (setq res-size 1081 ;; ... file mode flags
1082 (string-to-number 1082 (setq res-filemodes
1083 (or (cdr (assoc "standard::size" attributes)) "0"))) 1083 (let ((n (cdr (assoc "unix::mode" attributes))))
1084 ;; ... file mode flags 1084 (if n
1085 (setq res-filemodes 1085 (tramp-file-mode-from-int (string-to-number n))
1086 (let ((n (cdr (assoc "unix::mode" attributes)))) 1086 (format
1087 (if n 1087 "%s%s%s%s------"
1088 (tramp-file-mode-from-int (string-to-number n)) 1088 (if dirp "d" (if res-symlink-target "l" "-"))
1089 (format 1089 (if (equal (cdr (assoc "access::can-read" attributes))
1090 "%s%s%s%s------" 1090 "FALSE")
1091 (if dirp "d" (if res-symlink-target "l" "-")) 1091 "-" "r")
1092 (if (equal (cdr (assoc "access::can-read" attributes)) 1092 (if (equal (cdr (assoc "access::can-write" attributes))
1093 "FALSE") 1093 "FALSE")
1094 "-" "r") 1094 "-" "w")
1095 (if (equal (cdr (assoc "access::can-write" attributes)) 1095 (if (equal (cdr (assoc "access::can-execute" attributes))
1096 "FALSE") 1096 "FALSE")
1097 "-" "w") 1097 "-" "x")))))
1098 (if (equal (cdr (assoc "access::can-execute" attributes)) 1098 ;; ... inode and device
1099 "FALSE") 1099 (setq res-inode
1100 "-" "x"))))) 1100 (let ((n (cdr (assoc "unix::inode" attributes))))
1101 ;; ... inode and device 1101 (if n
1102 (setq res-inode 1102 (string-to-number n)
1103 (let ((n (cdr (assoc "unix::inode" attributes)))) 1103 (tramp-get-inode (tramp-dissect-file-name filename)))))
1104 (if n 1104 (setq res-device
1105 (string-to-number n) 1105 (let ((n (cdr (assoc "unix::device" attributes))))
1106 (tramp-get-inode (tramp-dissect-file-name filename))))) 1106 (if n
1107 (setq res-device 1107 (string-to-number n)
1108 (let ((n (cdr (assoc "unix::device" attributes)))) 1108 (tramp-get-device (tramp-dissect-file-name filename)))))
1109 (if n 1109
1110 (string-to-number n) 1110 ;; Return data gathered.
1111 (tramp-get-device (tramp-dissect-file-name filename))))) 1111 (list
1112 1112 ;; 0. t for directory, string (name linked to) for
1113 ;; Return data gathered. 1113 ;; symbolic link, or nil.
1114 (list 1114 (or dirp res-symlink-target)
1115 ;; 0. t for directory, string (name linked to) for 1115 ;; 1. Number of links to file.
1116 ;; symbolic link, or nil. 1116 res-numlinks
1117 (or dirp res-symlink-target) 1117 ;; 2. File uid.
1118 ;; 1. Number of links to file. 1118 res-uid
1119 res-numlinks 1119 ;; 3. File gid.
1120 ;; 2. File uid. 1120 res-gid
1121 res-uid 1121 ;; 4. Last access time, as a list of integers.
1122 ;; 3. File gid. 1122 ;; 5. Last modification time, likewise.
1123 res-gid 1123 ;; 6. Last status change time, likewise.
1124 ;; 4. Last access time, as a list of integers. 1124 res-access res-mod res-change
1125 ;; 5. Last modification time, likewise. 1125 ;; 7. Size in bytes (-1, if number is out of range).
1126 ;; 6. Last status change time, likewise. 1126 res-size
1127 res-access res-mod res-change 1127 ;; 8. File modes.
1128 ;; 7. Size in bytes (-1, if number is out of range). 1128 res-filemodes
1129 res-size 1129 ;; 9. t if file's gid would change if file were deleted
1130 ;; 8. File modes. 1130 ;; and recreated.
1131 res-filemodes 1131 nil
1132 ;; 9. t if file's gid would change if file were deleted 1132 ;; 10. Inode number.
1133 ;; and recreated. 1133 res-inode
1134 nil 1134 ;; 11. Device number.
1135 ;; 10. Inode number. 1135 res-device
1136 res-inode 1136 ))))
1137 ;; 11. Device number.
1138 res-device
1139 )))))
1140 1137
1141(defun tramp-gvfs-handle-file-executable-p (filename) 1138(defun tramp-gvfs-handle-file-executable-p (filename)
1142 "Like `file-executable-p' for Tramp files." 1139 "Like `file-executable-p' for Tramp files."
@@ -1744,13 +1741,7 @@ This is relevant for GNOME Online Accounts."
1744 ;; Ensure that GNOME Online Accounts are cached. 1741 ;; Ensure that GNOME Online Accounts are cached.
1745 (when (member (tramp-file-name-method vec) tramp-goa-methods) 1742 (when (member (tramp-file-name-method vec) tramp-goa-methods)
1746 (tramp-get-goa-accounts vec)) 1743 (tramp-get-goa-accounts vec))
1747 (tramp-get-connection-property 1744 (tramp-get-connection-property (tramp-make-goa-name vec) "prefix" "/")))
1748 (make-tramp-goa-name
1749 :method (tramp-file-name-method vec)
1750 :user (tramp-file-name-user vec)
1751 :host (tramp-file-name-host vec)
1752 :port (tramp-file-name-port vec))
1753 "prefix" "/")))
1754 1745
1755(defun tramp-gvfs-maybe-open-connection (vec) 1746(defun tramp-gvfs-maybe-open-connection (vec)
1756 "Maybe open a connection VEC. 1747 "Maybe open a connection VEC.
@@ -1781,15 +1772,24 @@ connection if a previous connection has died for some reason."
1781 1772
1782 (when (and (string-equal method "afp") 1773 (when (and (string-equal method "afp")
1783 (string-equal localname "/")) 1774 (string-equal localname "/"))
1784 (tramp-error vec 'file-error "Filename must contain an AFP volume")) 1775 (tramp-user-error vec "Filename must contain an AFP volume"))
1785 1776
1786 (when (and (string-match-p "davs?" method) 1777 (when (and (string-match-p "davs?" method)
1787 (string-equal localname "/")) 1778 (string-equal localname "/"))
1788 (tramp-error vec 'file-error "Filename must contain a WebDAV share")) 1779 (tramp-user-error vec "Filename must contain a WebDAV share"))
1789 1780
1790 (when (and (string-equal method "smb") 1781 (when (and (string-equal method "smb")
1791 (string-equal localname "/")) 1782 (string-equal localname "/"))
1792 (tramp-error vec 'file-error "Filename must contain a Windows share")) 1783 (tramp-user-error vec "Filename must contain a Windows share"))
1784
1785 (when (member method tramp-goa-methods)
1786 ;; Ensure that GNOME Online Accounts are cached.
1787 (tramp-get-goa-accounts vec)
1788 (when (tramp-get-connection-property
1789 (tramp-make-goa-name vec) "FilesDisabled" t)
1790 (tramp-user-error
1791 vec "There is no Online Account `%s'"
1792 (tramp-make-tramp-file-name vec 'noloc))))
1793 1793
1794 (with-tramp-progress-reporter 1794 (with-tramp-progress-reporter
1795 vec 3 1795 vec 3
@@ -1910,6 +1910,15 @@ is applied, and it returns t if the return code is zero."
1910 1910
1911;; D-Bus GNOME Online Accounts functions. 1911;; D-Bus GNOME Online Accounts functions.
1912 1912
1913(defun tramp-make-goa-name (vec)
1914 "Transform VEC into a `tramp-goa-name' structure."
1915 (when (tramp-file-name-p vec)
1916 (make-tramp-goa-name
1917 :method (tramp-file-name-method vec)
1918 :user (tramp-file-name-user vec)
1919 :host (tramp-file-name-host vec)
1920 :port (tramp-file-name-port vec))))
1921
1913(defun tramp-get-goa-accounts (vec) 1922(defun tramp-get-goa-accounts (vec)
1914 "Retrieve GNOME Online Accounts, and cache them. 1923 "Retrieve GNOME Online Accounts, and cache them.
1915The hash key is a `tramp-goa-name' structure. The value is an 1924The hash key is a `tramp-goa-name' structure. The value is an
@@ -1917,52 +1926,55 @@ alist of the properties of `tramp-goa-interface-account' and
1917`tramp-goa-interface-files' of the corresponding GNOME online 1926`tramp-goa-interface-files' of the corresponding GNOME online
1918account. Additionally, a property \"prefix\" is added. 1927account. Additionally, a property \"prefix\" is added.
1919VEC is used only for traces." 1928VEC is used only for traces."
1920 (dolist 1929 (with-tramp-connection-property (tramp-make-goa-name vec) "goa-accounts"
1921 (object-path 1930 (dolist
1922 (mapcar 1931 (object-path
1923 #'car 1932 (mapcar
1924 (tramp-dbus-function 1933 #'car
1925 vec #'dbus-get-all-managed-objects 1934 (tramp-dbus-function
1926 `(:session ,tramp-goa-service ,tramp-goa-path)))) 1935 vec #'dbus-get-all-managed-objects
1927 (let* ((account-properties 1936 `(:session ,tramp-goa-service ,tramp-goa-path))))
1928 (with-tramp-dbus-get-all-properties vec 1937 (let* ((account-properties
1929 :session tramp-goa-service object-path 1938 (with-tramp-dbus-get-all-properties vec
1930 tramp-goa-interface-account)) 1939 :session tramp-goa-service object-path
1931 (files-properties 1940 tramp-goa-interface-account))
1932 (with-tramp-dbus-get-all-properties vec 1941 (files-properties
1933 :session tramp-goa-service object-path 1942 (with-tramp-dbus-get-all-properties vec
1934 tramp-goa-interface-files)) 1943 :session tramp-goa-service object-path
1935 (identity 1944 tramp-goa-interface-files))
1936 (or (cdr (assoc "PresentationIdentity" account-properties)) "")) 1945 (identity
1937 key) 1946 (or (cdr (assoc "PresentationIdentity" account-properties)) ""))
1938 ;; Only accounts which matter. 1947 key)
1939 (when (and 1948 ;; Only accounts which matter.
1940 (not (cdr (assoc "FilesDisabled" account-properties))) 1949 (when (and
1941 (member 1950 (not (cdr (assoc "FilesDisabled" account-properties)))
1942 (cdr (assoc "ProviderType" account-properties)) 1951 (member
1943 '("google" "owncloud")) 1952 (cdr (assoc "ProviderType" account-properties))
1944 (string-match tramp-goa-identity-regexp identity)) 1953 '("google" "owncloud"))
1945 (setq key (make-tramp-goa-name 1954 (string-match tramp-goa-identity-regexp identity))
1946 :method (cdr (assoc "ProviderType" account-properties)) 1955 (setq key (make-tramp-goa-name
1947 :user (match-string 1 identity) 1956 :method (cdr (assoc "ProviderType" account-properties))
1948 :host (match-string 2 identity) 1957 :user (match-string 1 identity)
1949 :port (match-string 3 identity))) 1958 :host (match-string 2 identity)
1950 (when (string-equal (tramp-goa-name-method key) "google") 1959 :port (match-string 3 identity)))
1951 (setf (tramp-goa-name-method key) "gdrive")) 1960 (when (string-equal (tramp-goa-name-method key) "google")
1952 (when (string-equal (tramp-goa-name-method key) "owncloud") 1961 (setf (tramp-goa-name-method key) "gdrive"))
1953 (setf (tramp-goa-name-method key) "nextcloud")) 1962 (when (string-equal (tramp-goa-name-method key) "owncloud")
1954 ;; Cache all properties. 1963 (setf (tramp-goa-name-method key) "nextcloud"))
1955 (dolist (prop (nconc account-properties files-properties)) 1964 ;; Cache all properties.
1956 (tramp-set-connection-property key (car prop) (cdr prop))) 1965 (dolist (prop (nconc account-properties files-properties))
1957 ;; Cache "prefix". 1966 (tramp-set-connection-property key (car prop) (cdr prop)))
1958 (tramp-message 1967 ;; Cache "prefix".
1959 vec 10 "%s prefix %s" key 1968 (tramp-message
1960 (tramp-set-connection-property 1969 vec 10 "%s prefix %s" key
1961 key "prefix" 1970 (tramp-set-connection-property
1962 (directory-file-name 1971 key "prefix"
1963 (url-filename 1972 (directory-file-name
1964 (url-generic-parse-url 1973 (url-filename
1965 (tramp-get-connection-property key "Uri" "file:///")))))))))) 1974 (url-generic-parse-url
1975 (tramp-get-connection-property key "Uri" "file:///")))))))))
1976 ;; Mark, that goa accounts have been cached.
1977 "cached"))
1966 1978
1967 1979
1968;; D-Bus zeroconf functions. 1980;; D-Bus zeroconf functions.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 37b06cbe422..e5b0f149ca6 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3127,9 +3127,8 @@ User is always nil."
3127 ;; Native `file-equalp-p' calls `file-truename', which requires a 3127 ;; Native `file-equalp-p' calls `file-truename', which requires a
3128 ;; remote connection. This can be avoided, if FILENAME1 and 3128 ;; remote connection. This can be avoided, if FILENAME1 and
3129 ;; FILENAME2 are not located on the same remote host. 3129 ;; FILENAME2 are not located on the same remote host.
3130 (when (string-equal 3130 (when (tramp-equal-remote
3131 (file-remote-p (expand-file-name filename1)) 3131 (expand-file-name filename1) (expand-file-name filename2))
3132 (file-remote-p (expand-file-name filename2)))
3133 (tramp-run-real-handler #'file-equal-p (list filename1 filename2)))) 3132 (tramp-run-real-handler #'file-equal-p (list filename1 filename2))))
3134 3133
3135(defun tramp-handle-file-exists-p (filename) 3134(defun tramp-handle-file-exists-p (filename)
@@ -3141,9 +3140,8 @@ User is always nil."
3141 ;; Native `file-in-directory-p' calls `file-truename', which 3140 ;; Native `file-in-directory-p' calls `file-truename', which
3142 ;; requires a remote connection. This can be avoided, if FILENAME 3141 ;; requires a remote connection. This can be avoided, if FILENAME
3143 ;; and DIRECTORY are not located on the same remote host. 3142 ;; and DIRECTORY are not located on the same remote host.
3144 (when (string-equal 3143 (when (tramp-equal-remote
3145 (file-remote-p (expand-file-name filename)) 3144 (expand-file-name filename) (expand-file-name directory))
3146 (file-remote-p (expand-file-name directory)))
3147 (tramp-run-real-handler #'file-in-directory-p (list filename directory)))) 3145 (tramp-run-real-handler #'file-in-directory-p (list filename directory))))
3148 3146
3149(defun tramp-handle-file-local-copy (filename) 3147(defun tramp-handle-file-local-copy (filename)