aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2015-10-30 13:11:35 +0100
committerMichael Albinus2015-10-30 13:11:35 +0100
commit36574e0a238277f9c7ee7d39ce2b82fa3ca83061 (patch)
treef1163dd0a05416235df822744196111b233a4a41
parent3fb3af1d2a62e9a0a7bda7a296b621312919f922 (diff)
downloademacs-36574e0a238277f9c7ee7d39ce2b82fa3ca83061.tar.gz
emacs-36574e0a238277f9c7ee7d39ce2b82fa3ca83061.zip
Some minor fixes for tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-attributes): An attribute returned by gvfs-info might be empty. In case of undetermined uid or gid, return "UNKNOWN" or -1, respectively. (tramp-zeroconf-parse-service-device-names): New defun. Derived from `tramp-zeroconf-parse-workstation-device-names'. (top): Add completion functions for "afp" and "smb" methods.
-rw-r--r--lisp/net/tramp-gvfs.el77
1 files changed, 35 insertions, 42 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index c68b5e4c55c..b93c4cf57a5 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -48,7 +48,7 @@
48;; comments. 48;; comments.
49 49
50;; The custom option `tramp-gvfs-methods' contains the list of 50;; The custom option `tramp-gvfs-methods' contains the list of
51;; supported connection methods. Per default, these are "dav", 51;; supported connection methods. Per default, these are "afp", "dav",
52;; "davs", "obex", "sftp" and "synce". Note that with "obex" it might 52;; "davs", "obex", "sftp" and "synce". Note that with "obex" it might
53;; be necessary to pair with the other bluetooth device, if it hasn't 53;; be necessary to pair with the other bluetooth device, if it hasn't
54;; been done already. There might be also some few seconds delay in 54;; been done already. There might be also some few seconds delay in
@@ -78,7 +78,7 @@
78 78
79;; For hostname completion, information is retrieved either from the 79;; For hostname completion, information is retrieved either from the
80;; bluez daemon (for the "obex" method), the hal daemon (for the 80;; bluez daemon (for the "obex" method), the hal daemon (for the
81;; "synce" method), or from the zeroconf daemon (for the "dav", 81;; "synce" method), or from the zeroconf daemon (for the "afp", "dav",
82;; "davs", and "sftp" methods). The zeroconf daemon is pre-configured 82;; "davs", and "sftp" methods). The zeroconf daemon is pre-configured
83;; to discover services in the "local" domain. If another domain 83;; to discover services in the "local" domain. If another domain
84;; shall be used for discovering services, the custom option 84;; shall be used for discovering services, the custom option
@@ -808,83 +808,72 @@ file names."
808 (when (re-search-forward "attributes:" nil t) 808 (when (re-search-forward "attributes:" nil t)
809 ;; ... directory or symlink 809 ;; ... directory or symlink
810 (goto-char (point-min)) 810 (goto-char (point-min))
811 (setq dirp (if (re-search-forward "type:\\s-+directory" nil t) t)) 811 (setq dirp (if (re-search-forward "type: directory" nil t) t))
812 (goto-char (point-min)) 812 (goto-char (point-min))
813 (setq res-symlink-target 813 (setq res-symlink-target
814 (if (re-search-forward 814 (if (re-search-forward
815 "standard::symlink-target:\\s-+\\(.*\\)$" nil t) 815 "standard::symlink-target: \\(.+\\)$" nil t)
816 (match-string 1))) 816 (match-string 1)))
817 ;; ... number links 817 ;; ... number links
818 (goto-char (point-min)) 818 (goto-char (point-min))
819 (setq res-numlinks 819 (setq res-numlinks
820 (if (re-search-forward 820 (if (re-search-forward "unix::nlink: \\([0-9]+\\)" nil t)
821 "unix::nlink:\\s-+\\([0-9]+\\)" nil t)
822 (string-to-number (match-string 1)) 0)) 821 (string-to-number (match-string 1)) 0))
823 ;; ... uid and gid 822 ;; ... uid and gid
824 (goto-char (point-min)) 823 (goto-char (point-min))
825 (setq res-uid 824 (setq res-uid
826 (or (if (eq id-format 'integer) 825 (if (eq id-format 'integer)
827 (if (re-search-forward 826 (if (re-search-forward "unix::uid: \\([0-9]+\\)" nil t)
828 "unix::uid:\\s-+\\([0-9]+\\)" nil t) 827 (string-to-number (match-string 1))
829 (string-to-number (match-string 1))) 828 -1)
830 (if (and 829 (if (re-search-forward "owner::user: \\(.+\\)$" nil t)
831 (re-search-forward "owner::user:\\s-+" nil t) 830 (match-string 1)
832 (re-search-forward "(\\S-+\\)" (point-at-eol) t)) 831 "UNKNOWN")))
833 (match-string 1)))
834 (tramp-get-local-uid id-format)))
835 (setq res-gid 832 (setq res-gid
836 (or (if (eq id-format 'integer) 833 (if (eq id-format 'integer)
837 (if (re-search-forward 834 (if (re-search-forward "unix::gid: \\([0-9]+\\)" nil t)
838 "unix::gid:\\s-+\\([0-9]+\\)" nil t) 835 (string-to-number (match-string 1))
839 (string-to-number (match-string 1))) 836 -1)
840 (if (and 837 (if (re-search-forward "owner::group: \\(.+\\)$" nil t)
841 (re-search-forward "owner::group:\\s-+" nil t) 838 (match-string 1)
842 (re-search-forward "(\\S-+\\)" (point-at-eol) t)) 839 "UNKNOWN")))
843 (match-string 1)))
844 (tramp-get-local-gid id-format)))
845 ;; ... last access, modification and change time 840 ;; ... last access, modification and change time
846 (goto-char (point-min)) 841 (goto-char (point-min))
847 (setq res-access 842 (setq res-access
848 (if (re-search-forward 843 (if (re-search-forward "time::access: \\([0-9]+\\)" nil t)
849 "time::access:\\s-+\\([0-9]+\\)" nil t)
850 (seconds-to-time (string-to-number (match-string 1))) 844 (seconds-to-time (string-to-number (match-string 1)))
851 '(0 0))) 845 '(0 0)))
852 (goto-char (point-min)) 846 (goto-char (point-min))
853 (setq res-mod 847 (setq res-mod
854 (if (re-search-forward 848 (if (re-search-forward "time::modified: \\([0-9]+\\)" nil t)
855 "time::modified:\\s-+\\([0-9]+\\)" nil t)
856 (seconds-to-time (string-to-number (match-string 1))) 849 (seconds-to-time (string-to-number (match-string 1)))
857 '(0 0))) 850 '(0 0)))
858 (goto-char (point-min)) 851 (goto-char (point-min))
859 (setq res-change 852 (setq res-change
860 (if (re-search-forward 853 (if (re-search-forward "time::changed: \\([0-9]+\\)" nil t)
861 "time::changed:\\s-+\\([0-9]+\\)" nil t)
862 (seconds-to-time (string-to-number (match-string 1))) 854 (seconds-to-time (string-to-number (match-string 1)))
863 '(0 0))) 855 '(0 0)))
864 ;; ... size 856 ;; ... size
865 (goto-char (point-min)) 857 (goto-char (point-min))
866 (setq res-size 858 (setq res-size
867 (if (re-search-forward 859 (if (re-search-forward "standard::size: \\([0-9]+\\)" nil t)
868 "standard::size:\\s-+\\([0-9]+\\)" nil t)
869 (string-to-number (match-string 1)) 0)) 860 (string-to-number (match-string 1)) 0))
870 ;; ... file mode flags 861 ;; ... file mode flags
871 (goto-char (point-min)) 862 (goto-char (point-min))
872 (setq res-filemodes 863 (setq res-filemodes
873 (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t) 864 (if (re-search-forward "unix::mode: \\([0-9]+\\)" nil t)
874 (tramp-file-mode-from-int 865 (tramp-file-mode-from-int
875 (string-to-number (match-string 1))) 866 (string-to-number (match-string 1)))
876 (if dirp "drwx------" "-rwx------"))) 867 (if dirp "drwx------" "-rwx------")))
877 ;; ... inode and device 868 ;; ... inode and device
878 (goto-char (point-min)) 869 (goto-char (point-min))
879 (setq res-inode 870 (setq res-inode
880 (if (re-search-forward 871 (if (re-search-forward "unix::inode: \\([0-9]+\\)" nil t)
881 "unix::inode:\\s-+\\([0-9]+\\)" nil t)
882 (string-to-number (match-string 1)) 872 (string-to-number (match-string 1))
883 (tramp-get-inode v))) 873 (tramp-get-inode v)))
884 (goto-char (point-min)) 874 (goto-char (point-min))
885 (setq res-device 875 (setq res-device
886 (if (re-search-forward 876 (if (re-search-forward "unix::device: \\([0-9]+\\)" nil t)
887 "unix::device:\\s-+\\([0-9]+\\)" nil t)
888 (string-to-number (match-string 1)) 877 (string-to-number (match-string 1))
889 (tramp-get-device v))) 878 (tramp-get-device v)))
890 879
@@ -1733,12 +1722,12 @@ be used."
1733 1722
1734;; D-Bus zeroconf functions. 1723;; D-Bus zeroconf functions.
1735 1724
1736(defun tramp-zeroconf-parse-workstation-device-names (_ignore) 1725(defun tramp-zeroconf-parse-service-device-names (service)
1737 "Return a list of (user host) tuples allowed to access." 1726 "Return a list of (user host) tuples allowed to access."
1738 (mapcar 1727 (mapcar
1739 (lambda (x) 1728 (lambda (x)
1740 (list nil (zeroconf-service-host x))) 1729 (list nil (zeroconf-service-host x)))
1741 (zeroconf-list-services "_workstation._tcp"))) 1730 (zeroconf-list-services service)))
1742 1731
1743(defun tramp-zeroconf-parse-webdav-device-names (_ignore) 1732(defun tramp-zeroconf-parse-webdav-device-names (_ignore)
1744 "Return a list of (user host) tuples allowed to access." 1733 "Return a list of (user host) tuples allowed to access."
@@ -1758,16 +1747,20 @@ be used."
1758 (list user host))) 1747 (list user host)))
1759 (zeroconf-list-services "_webdav._tcp"))) 1748 (zeroconf-list-services "_webdav._tcp")))
1760 1749
1761;; Add completion function for SFTP, DAV and DAVS methods. 1750;; Add completion functions for AFP, DAV, DAVS, SFTP and SMB methods.
1762(when (and tramp-gvfs-enabled 1751(when (and tramp-gvfs-enabled
1763 (member zeroconf-service-avahi (dbus-list-known-names :system))) 1752 (member zeroconf-service-avahi (dbus-list-known-names :system)))
1764 (zeroconf-init tramp-gvfs-zeroconf-domain) 1753 (zeroconf-init tramp-gvfs-zeroconf-domain)
1765 (tramp-set-completion-function 1754 (tramp-set-completion-function
1766 "sftp" '((tramp-zeroconf-parse-workstation-device-names ""))) 1755 "afp" '((tramp-zeroconf-parse-service-device-names "_afpovertcp._tcp")))
1767 (tramp-set-completion-function 1756 (tramp-set-completion-function
1768 "dav" '((tramp-zeroconf-parse-webdav-device-names ""))) 1757 "dav" '((tramp-zeroconf-parse-webdav-device-names "")))
1769 (tramp-set-completion-function 1758 (tramp-set-completion-function
1770 "davs" '((tramp-zeroconf-parse-webdav-device-names "")))) 1759 "davs" '((tramp-zeroconf-parse-webdav-device-names "")))
1760 (tramp-set-completion-function
1761 "sftp" '((tramp-zeroconf-parse-service-device-names "_workstation._tcp")))
1762 (tramp-set-completion-function
1763 "smb" '((tramp-zeroconf-parse-service-device-names "_smb._tcp"))))
1771 1764
1772 1765
1773;; D-Bus SYNCE functions. 1766;; D-Bus SYNCE functions.