summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-03-26 20:47:12 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-03-26 20:47:12 +0200
commitd0be0d541d3925b2f13cfb1a056046770829cef2 (patch)
treeef83d16f43c42c5550d16ce8c00e5d20797036a5
parentb4a3be783aee05eaf0155354e71ca2ce1d5356e7 (diff)
downloademacs-d0be0d541d3925b2f13cfb1a056046770829cef2.tar.gz
Add sanity check in tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-listmountableinfo) (tramp-gvfs-listmounttypes): New defconst. (tramp-gvfs-maybe-open-connection): Add sanity check whether GVFS backend is available.
-rw-r--r--lisp/net/tramp-gvfs.el43
1 files changed, 43 insertions, 0 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 0d23f5d88d5..c84f96d3c61 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -210,6 +210,20 @@ They are checked during start up via
tramp-gvfs-interface-mounttracker))
"The list of supported methods of the mount tracking interface.")
+(defconst tramp-gvfs-listmountableinfo
+ (if (member "ListMountableInfo" tramp-gvfs-methods-mounttracker)
+ "ListMountableInfo"
+ "listMountableInfo")
+ "The name of the \"listMountableInfo\" method.
+It has been changed in GVFS 1.14.")
+
+(defconst tramp-gvfs-listmounttypes
+ (if (member "ListMountTypes" tramp-gvfs-methods-mounttracker)
+ "ListMountTypes"
+ "listMountTypes")
+ "The name of the \"listMountTypes\" method.
+It has been changed in GVFS 1.14.")
+
(defconst tramp-gvfs-listmounts
(if (member "ListMounts" tramp-gvfs-methods-mounttracker)
"ListMounts"
@@ -233,6 +247,12 @@ It has been changed in GVFS 1.14.")
It has been changed in GVFS 1.14.")
;; <interface name='org.gtk.vfs.MountTracker'>
+;; <method name='listMountableInfo'>
+;; <arg name='mountables' type='a(ssasib)' direction='out'/>
+;; </method>
+;; <method name='listMountTypes'>
+;; <arg name='mount_types' type='as' direction='out'/>
+;; </method>
;; <method name='listMounts'>
;; <arg name='mount_info_list'
;; type='a{sosssssbay{aya{say}}ay}'
@@ -253,6 +273,13 @@ It has been changed in GVFS 1.14.")
;; </signal>
;; </interface>
;;
+;; STRUCT mountable
+;; STRING type
+;; STRING scheme
+;; ARRAY STRING scheme_aliases
+;; INT32 default_port
+;; BOOLEAN host_is_inet
+;;
;; STRUCT mount_info
;; STRING dbus_id
;; OBJECT_PATH object_path
@@ -2152,6 +2179,22 @@ connection if a previous connection has died for some reason."
(unless (tramp-connectable-p vec)
(throw 'non-essential 'non-essential))
+ ;; Sanity check.
+ (let ((method (tramp-file-name-method vec)))
+ (unless (member
+ (or (rassoc method '(("smb" . "smb-share")
+ ("davs" . "dav")
+ ("nextcloud" . "dav")
+ ("afp". "afp-volume")
+ ("gdrive" . "google-drive")))
+ method)
+ (with-tramp-dbus-call-method vec t
+ :session tramp-gvfs-service-daemon
+ tramp-gvfs-path-mounttracker
+ tramp-gvfs-interface-mounttracker
+ tramp-gvfs-listmounttypes))
+ (tramp-error vec 'file-error "Method `%s' not supported by GVFS" method)))
+
;; For password handling, we need a process bound to the connection
;; buffer. Therefore, we create a dummy process. Maybe there is a
;; better solution?