From: Michael Albinus Date: Sun, 26 Mar 2023 18:47:12 +0000 (+0200) Subject: Add sanity check in tramp-gvfs.el X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d0be0d541d3925b2f13cfb1a056046770829cef2;p=emacs.git 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. --- 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.") ;; +;; +;; +;; +;; +;; +;; ;; ;; ;; ;; +;; 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?