emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d0be0d541d3 1/2: Add sanity check in tramp-gvfs.el


From: Michael Albinus
Subject: master d0be0d541d3 1/2: Add sanity check in tramp-gvfs.el
Date: Sun, 26 Mar 2023 14:48:11 -0400 (EDT)

branch: master
commit d0be0d541d3925b2f13cfb1a056046770829cef2
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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.
---
 lisp/net/tramp-gvfs.el | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]