aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2014-02-19 20:24:32 +0100
committerMichael Albinus2014-02-19 20:24:32 +0100
commit50bfdd5d78aa015d9032da7e6376665243f3f3b1 (patch)
tree0a5f65cdd2f87aa4674e47231df76ebba5c9ccd8
parentd34f67dae3caa277bfebe0aa9f60e83a22bce0eb (diff)
downloademacs-50bfdd5d78aa015d9032da7e6376665243f3f3b1.tar.gz
emacs-50bfdd5d78aa015d9032da7e6376665243f3f3b1.zip
Some Tramp minor fixes, found during test campaign.
* net/tramp-adb.el (tramp-adb-file-name-handler-alist) [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'. * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist) [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'. (tramp-gvfs-maybe-open-connection): Set always connection properties, even if target is mounted already. * net/tramp-sh.el (tramp-color-escape-sequence-regexp): Set tramp-autoload cookie. (tramp-get-remote-touch): New defun. (tramp-sh-handle-set-file-times): Use it. (tramp-sh-handle-directory-files-and-attributes): Use `tramp-handle-directory-files-and-attributes' if neither stat nor perl are available on the remote host. * net/tramp-smb.el (tramp-smb-handle-insert-directory): Mark trailing "/". Write long listing only when "l" belongs to the switches. * net/tramp.el (tramp-handle-make-symbolic-link): New defun. (tramp-check-cached-permissions): Call `file-attributes' if the cache is empty. * net/trampver.el: Update release number.
-rw-r--r--lisp/ChangeLog27
-rw-r--r--lisp/net/tramp-adb.el2
-rw-r--r--lisp/net/tramp-gvfs.el28
-rw-r--r--lisp/net/tramp-sh.el136
-rw-r--r--lisp/net/tramp-smb.el67
-rw-r--r--lisp/net/tramp.el21
-rw-r--r--lisp/net/trampver.el4
7 files changed, 186 insertions, 99 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f65b33e679f..733c83f467c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,30 @@
12014-02-19 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-handle-make-symbolic-link): New defun.
4 (tramp-check-cached-permissions): Call `file-attributes' if the
5 cache is empty.
6
7 * net/tramp-adb.el (tramp-adb-file-name-handler-alist)
8 [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'.
9
10 * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist)
11 [make-symbolic-link]: Use `tramp-handle-make-symbolic-link'.
12 (tramp-gvfs-maybe-open-connection): Set always connection
13 properties, even if target is mounted already.
14
15 * net/tramp-sh.el (tramp-color-escape-sequence-regexp):
16 Set tramp-autoload cookie.
17 (tramp-get-remote-touch): New defun.
18 (tramp-sh-handle-set-file-times): Use it.
19 (tramp-sh-handle-directory-files-and-attributes):
20 Use `tramp-handle-directory-files-and-attributes' if neither stat
21 nor perl are available on the remote host.
22
23 * net/tramp-smb.el (tramp-smb-handle-insert-directory): Mark trailing
24 "/". Write long listing only when "l" belongs to the switches.
25
26 * net/trampver.el: Update release number.
27
12014-02-19 Juanma Barranquero <lekktu@gmail.com> 282014-02-19 Juanma Barranquero <lekktu@gmail.com>
2 29
3 * frameset.el (frameset--reuse-frame): Remove workaround for bug#16793. 30 * frameset.el (frameset--reuse-frame): Remove workaround for bug#16793.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 2cb5ece10dd..8f2098c136b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -140,7 +140,7 @@
140 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) 140 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
141 (make-directory . tramp-adb-handle-make-directory) 141 (make-directory . tramp-adb-handle-make-directory)
142 (make-directory-internal . ignore) 142 (make-directory-internal . ignore)
143 (make-symbolic-link . ignore) 143 (make-symbolic-link . tramp-handle-make-symbolic-link)
144 (process-file . tramp-adb-handle-process-file) 144 (process-file . tramp-adb-handle-process-file)
145 (rename-file . tramp-adb-handle-rename-file) 145 (rename-file . tramp-adb-handle-rename-file)
146 (set-file-acl . ignore) 146 (set-file-acl . ignore)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 13bc3719655..38b53afea45 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -457,7 +457,7 @@ Every entry is a list (NAME ADDRESS).")
457 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) 457 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
458 (make-directory . tramp-gvfs-handle-make-directory) 458 (make-directory . tramp-gvfs-handle-make-directory)
459 (make-directory-internal . ignore) 459 (make-directory-internal . ignore)
460 (make-symbolic-link . ignore) 460 (make-symbolic-link . tramp-handle-make-symbolic-link)
461 (process-file . ignore) 461 (process-file . ignore)
462 (rename-file . tramp-gvfs-handle-rename-file) 462 (rename-file . tramp-gvfs-handle-rename-file)
463 (set-file-acl . ignore) 463 (set-file-acl . ignore)
@@ -1547,19 +1547,19 @@ connection if a previous connection has died for some reason."
1547 ;; is marked with the fuse-mountpoint "/". We shall react. 1547 ;; is marked with the fuse-mountpoint "/". We shall react.
1548 (when (string-equal 1548 (when (string-equal
1549 (tramp-get-file-property vec "/" "fuse-mountpoint" "") "/") 1549 (tramp-get-file-property vec "/" "fuse-mountpoint" "") "/")
1550 (tramp-error vec 'file-error "FUSE mount denied")) 1550 (tramp-error vec 'file-error "FUSE mount denied")))))
1551 1551
1552 ;; In `tramp-check-cached-permissions', the connection 1552 ;; In `tramp-check-cached-permissions', the connection properties
1553 ;; properties {uig,gid}-{integer,string} are used. We set 1553 ;; {uig,gid}-{integer,string} are used. We set them to their local
1554 ;; them to their local counterparts. 1554 ;; counterparts.
1555 (tramp-set-connection-property 1555 (with-tramp-connection-property
1556 vec "uid-integer" (tramp-get-local-uid 'integer)) 1556 vec "uid-integer" (tramp-get-local-uid 'integer))
1557 (tramp-set-connection-property 1557 (with-tramp-connection-property
1558 vec "gid-integer" (tramp-get-local-gid 'integer)) 1558 vec "gid-integer" (tramp-get-local-gid 'integer))
1559 (tramp-set-connection-property 1559 (with-tramp-connection-property
1560 vec "uid-string" (tramp-get-local-uid 'string)) 1560 vec "uid-string" (tramp-get-local-uid 'string))
1561 (tramp-set-connection-property 1561 (with-tramp-connection-property
1562 vec "gid-string" (tramp-get-local-gid 'string)))))) 1562 vec "gid-string" (tramp-get-local-gid 'string)))
1563 1563
1564(defun tramp-gvfs-send-command (vec command &rest args) 1564(defun tramp-gvfs-send-command (vec command &rest args)
1565 "Send the COMMAND with its ARGS to connection VEC. 1565 "Send the COMMAND with its ARGS to connection VEC.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index fc906b343cb..4284fecf14f 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -60,6 +60,7 @@ files conditionalize this setup based on the TERM environment variable."
60 :group 'tramp 60 :group 'tramp
61 :type 'string) 61 :type 'string)
62 62
63;;;###tramp-autoload
63(defconst tramp-color-escape-sequence-regexp "\e[[;0-9]+m" 64(defconst tramp-color-escape-sequence-regexp "\e[[;0-9]+m"
64 "Escape sequences produced by the \"ls\" command.") 65 "Escape sequences produced by the \"ls\" command.")
65 66
@@ -1305,22 +1306,29 @@ of."
1305 "Like `set-file-times' for Tramp files." 1306 "Like `set-file-times' for Tramp files."
1306 (if (tramp-tramp-file-p filename) 1307 (if (tramp-tramp-file-p filename)
1307 (with-parsed-tramp-file-name filename nil 1308 (with-parsed-tramp-file-name filename nil
1308 (tramp-flush-file-property v localname) 1309 (when (tramp-get-remote-touch v)
1309 (let ((time (if (or (null time) (equal time '(0 0))) 1310 (tramp-flush-file-property v localname)
1310 (current-time) 1311 (let ((time (if (or (null time) (equal time '(0 0)))
1311 time)) 1312 (current-time)
1312 ;; With GNU Emacs, `format-time-string' has an optional 1313 time))
1313 ;; parameter UNIVERSAL. This is preferred, because we 1314 ;; With GNU Emacs, `format-time-string' has an
1314 ;; could handle the case when the remote host is located 1315 ;; optional parameter UNIVERSAL. This is preferred,
1315 ;; in a different time zone as the local host. 1316 ;; because we could handle the case when the remote
1316 (utc (not (featurep 'xemacs)))) 1317 ;; host is located in a different time zone as the
1317 (tramp-send-command-and-check 1318 ;; local host.
1318 v (format "%s touch -t %s %s" 1319 (utc (not (featurep 'xemacs))))
1319 (if utc "env TZ=UTC" "") 1320 (tramp-send-command-and-check
1320 (if utc 1321 v (format
1321 (format-time-string "%Y%m%d%H%M.%S" time t) 1322 "%s %s %s %s"
1322 (format-time-string "%Y%m%d%H%M.%S" time)) 1323 (if utc "env TZ=UTC" "")
1323 (tramp-shell-quote-argument localname))))) 1324 (tramp-get-remote-touch v)
1325 (if (tramp-get-connection-property v "touch-t" nil)
1326 (format "-t %s"
1327 (if utc
1328 (format-time-string "%Y%m%d%H%M.%S" time t)
1329 (format-time-string "%Y%m%d%H%M.%S" time)))
1330 "")
1331 (tramp-shell-quote-argument localname))))))
1324 1332
1325 ;; We handle also the local part, because in older Emacsen, 1333 ;; We handle also the local part, because in older Emacsen,
1326 ;; without `set-file-times', this function is an alias for this. 1334 ;; without `set-file-times', this function is an alias for this.
@@ -1562,39 +1570,45 @@ be non-negative integers."
1562(defun tramp-sh-handle-directory-files-and-attributes 1570(defun tramp-sh-handle-directory-files-and-attributes
1563 (directory &optional full match nosort id-format) 1571 (directory &optional full match nosort id-format)
1564 "Like `directory-files-and-attributes' for Tramp files." 1572 "Like `directory-files-and-attributes' for Tramp files."
1565 (unless id-format (setq id-format 'integer)) 1573 (if (with-parsed-tramp-file-name directory nil
1566 (when (file-directory-p directory) 1574 (not (or (tramp-get-remote-stat v) (tramp-get-remote-perl v))))
1567 (setq directory (expand-file-name directory)) 1575 (tramp-handle-directory-files-and-attributes
1568 (let* ((temp 1576 directory full match nosort id-format)
1569 (copy-tree 1577
1570 (with-parsed-tramp-file-name directory nil 1578 ;; Do it directly.
1571 (with-tramp-file-property 1579 (unless id-format (setq id-format 'integer))
1572 v localname 1580 (when (file-directory-p directory)
1573 (format "directory-files-and-attributes-%s" id-format) 1581 (setq directory (expand-file-name directory))
1574 (save-excursion 1582 (let* ((temp
1575 (mapcar 1583 (copy-tree
1576 (lambda (x) 1584 (with-parsed-tramp-file-name directory nil
1577 (cons (car x) 1585 (with-tramp-file-property
1578 (tramp-convert-file-attributes v (cdr x)))) 1586 v localname
1579 (cond 1587 (format "directory-files-and-attributes-%s" id-format)
1580 ((tramp-get-remote-stat v) 1588 (save-excursion
1581 (tramp-do-directory-files-and-attributes-with-stat 1589 (mapcar
1582 v localname id-format)) 1590 (lambda (x)
1583 ((tramp-get-remote-perl v) 1591 (cons (car x)
1584 (tramp-do-directory-files-and-attributes-with-perl 1592 (tramp-convert-file-attributes v (cdr x))))
1585 v localname id-format))))))))) 1593 (cond
1586 result item) 1594 ((tramp-get-remote-stat v)
1587 1595 (tramp-do-directory-files-and-attributes-with-stat
1588 (while temp 1596 v localname id-format))
1589 (setq item (pop temp)) 1597 ((tramp-get-remote-perl v)
1590 (when (or (null match) (string-match match (car item))) 1598 (tramp-do-directory-files-and-attributes-with-perl
1591 (when full 1599 v localname id-format)))))))))
1592 (setcar item (expand-file-name (car item) directory))) 1600 result item)
1593 (push item result))) 1601
1594 1602 (while temp
1595 (if nosort 1603 (setq item (pop temp))
1596 result 1604 (when (or (null match) (string-match match (car item)))
1597 (sort result (lambda (x y) (string< (car x) (car y)))))))) 1605 (when full
1606 (setcar item (expand-file-name (car item) directory)))
1607 (push item result)))
1608
1609 (if nosort
1610 result
1611 (sort result (lambda (x y) (string< (car x) (car y)))))))))
1598 1612
1599(defun tramp-do-directory-files-and-attributes-with-perl 1613(defun tramp-do-directory-files-and-attributes-with-perl
1600 (vec localname &optional id-format) 1614 (vec localname &optional id-format)
@@ -4999,6 +5013,30 @@ Return ATTR."
4999 (tramp-message vec 5 "Finding a suitable `trash' command") 5013 (tramp-message vec 5 "Finding a suitable `trash' command")
5000 (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))) 5014 (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
5001 5015
5016(defun tramp-get-remote-touch (vec)
5017 (with-tramp-connection-property vec "touch"
5018 (tramp-message vec 5 "Finding a suitable `touch' command")
5019 (let ((result (tramp-find-executable
5020 vec "touch" (tramp-get-remote-path vec)))
5021 (tmpfile
5022 (make-temp-name
5023 (expand-file-name
5024 tramp-temp-name-prefix (tramp-get-remote-tmpdir vec)))))
5025 ;; Busyboxes do support the "-t" option only when they have been
5026 ;; built with the DESKTOP config option. Let's check it.
5027 (when result
5028 (tramp-set-connection-property
5029 vec "touch-t"
5030 (tramp-send-command-and-check
5031 vec
5032 (format
5033 "%s -t %s %s"
5034 result
5035 (format-time-string "%Y%m%d%H%M.%S" (current-time))
5036 (tramp-file-name-handler 'file-remote-p tmpfile 'localname))))
5037 (delete-file tmpfile))
5038 result)))
5039
5002(defun tramp-get-remote-gvfs-monitor-dir (vec) 5040(defun tramp-get-remote-gvfs-monitor-dir (vec)
5003 (with-tramp-connection-property vec "gvfs-monitor-dir" 5041 (with-tramp-connection-property vec "gvfs-monitor-dir"
5004 (tramp-message vec 5 "Finding a suitable `gvfs-monitor-dir' command") 5042 (tramp-message vec 5 "Finding a suitable `gvfs-monitor-dir' command")
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 97a892f9858..43e2c494ece 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -929,6 +929,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
929 "Like `insert-directory' for Tramp files." 929 "Like `insert-directory' for Tramp files."
930 (setq filename (expand-file-name filename)) 930 (setq filename (expand-file-name filename))
931 (unless switches (setq switches "")) 931 (unless switches (setq switches ""))
932 ;; Mark trailing "/".
933 (when (and (zerop (length (file-name-nondirectory filename)))
934 (not full-directory-p))
935 (setq switches (concat switches "F")))
932 (if full-directory-p 936 (if full-directory-p
933 ;; Called from `dired-add-entry'. 937 ;; Called from `dired-add-entry'.
934 (setq filename (file-name-as-directory filename)) 938 (setq filename (file-name-as-directory filename))
@@ -991,38 +995,41 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
991 (mapc 995 (mapc
992 (lambda (x) 996 (lambda (x)
993 (when (not (zerop (length (nth 0 x)))) 997 (when (not (zerop (length (nth 0 x))))
994 (let ((attr 998 (when (string-match "l" switches)
995 (when (tramp-smb-get-stat-capability v) 999 (let ((attr
996 (ignore-errors 1000 (when (tramp-smb-get-stat-capability v)
997 (file-attributes filename 'string))))) 1001 (ignore-errors
998 (insert 1002 (file-attributes filename 'string)))))
999 (format
1000 "%10s %3d %-8s %-8s %8s %s "
1001 (or (nth 8 attr) (nth 1 x)) ; mode
1002 (or (nth 1 attr) 1) ; inode
1003 (or (nth 2 attr) "nobody") ; uid
1004 (or (nth 3 attr) "nogroup") ; gid
1005 (or (nth 7 attr) (nth 2 x)) ; size
1006 (format-time-string
1007 (if (tramp-time-less-p
1008 (tramp-time-subtract (current-time) (nth 3 x))
1009 tramp-half-a-year)
1010 "%b %e %R"
1011 "%b %e %Y")
1012 (nth 3 x)))) ; date
1013 ;; We mark the file name. The inserted name could be
1014 ;; from somewhere else, so we use the relative file
1015 ;; name of `default-directory'.
1016 (let ((start (point)))
1017 (insert 1003 (insert
1018 (format 1004 (format
1019 "%s\n" 1005 "%10s %3d %-8s %-8s %8s %s "
1020 (file-relative-name 1006 (or (nth 8 attr) (nth 1 x)) ; mode
1021 (expand-file-name 1007 (or (nth 1 attr) 1) ; inode
1022 (nth 0 x) (file-name-directory filename))))) 1008 (or (nth 2 attr) "nobody") ; uid
1023 (put-text-property start (1- (point)) 'dired-filename t)) 1009 (or (nth 3 attr) "nogroup") ; gid
1024 (forward-line) 1010 (or (nth 7 attr) (nth 2 x)) ; size
1025 (beginning-of-line)))) 1011 (format-time-string
1012 (if (tramp-time-less-p
1013 (tramp-time-subtract (current-time) (nth 3 x))
1014 tramp-half-a-year)
1015 "%b %e %R"
1016 "%b %e %Y")
1017 (nth 3 x)))))) ; date
1018
1019 ;; We mark the file name. The inserted name could be
1020 ;; from somewhere else, so we use the relative file name
1021 ;; of `default-directory'.
1022 (let ((start (point)))
1023 (insert
1024 (format
1025 "%s\n"
1026 (file-relative-name
1027 (expand-file-name
1028 (nth 0 x) (file-name-directory filename))
1029 (when full-directory-p (file-name-directory filename)))))
1030 (put-text-property start (1- (point)) 'dired-filename t))
1031 (forward-line)
1032 (beginning-of-line)))
1026 entries))))) 1033 entries)))))
1027 1034
1028(defun tramp-smb-handle-make-directory (dir &optional parents) 1035(defun tramp-smb-handle-make-directory (dir &optional parents)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8ac654c70ab..aa9881be997 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3150,6 +3150,13 @@ User is always nil."
3150 (delete-file local-copy))))) 3150 (delete-file local-copy)))))
3151 t))) 3151 t)))
3152 3152
3153(defun tramp-handle-make-symbolic-link
3154 (filename linkname &optional ok-if-already-exists)
3155 "Like `make-symbolic-link' for Tramp files."
3156 (with-parsed-tramp-file-name
3157 (if (tramp-tramp-file-p filename) filename linkname) nil
3158 (tramp-error v 'file-error "make-symbolic-link not supported")))
3159
3153(defun tramp-handle-shell-command 3160(defun tramp-handle-shell-command
3154 (command &optional output-buffer error-buffer) 3161 (command &optional output-buffer error-buffer)
3155 "Like `shell-command' for Tramp files." 3162 "Like `shell-command' for Tramp files."
@@ -3819,9 +3826,17 @@ be granted."
3819 (or 3826 (or
3820 result 3827 result
3821 (let ((file-attr 3828 (let ((file-attr
3822 (tramp-get-file-property 3829 (or
3823 vec (tramp-file-name-localname vec) 3830 (tramp-get-file-property
3824 (concat "file-attributes-" suffix) nil)) 3831 vec (tramp-file-name-localname vec)
3832 (concat "file-attributes-" suffix) nil)
3833 (file-attributes
3834 (tramp-make-tramp-file-name
3835 (tramp-file-name-method vec)
3836 (tramp-file-name-user vec)
3837 (tramp-file-name-host vec)
3838 (tramp-file-name-localname vec))
3839 suffix)))
3825 (remote-uid 3840 (remote-uid
3826 (tramp-get-connection-property 3841 (tramp-get-connection-property
3827 vec (concat "uid-" suffix) nil)) 3842 vec (concat "uid-" suffix) nil))
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 077aedb4d5f..1ee6e6ad025 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -31,7 +31,7 @@
31;; should be changed only there. 31;; should be changed only there.
32 32
33;;;###tramp-autoload 33;;;###tramp-autoload
34(defconst tramp-version "2.2.9" 34(defconst tramp-version "2.2.9-24.4"
35 "This version of Tramp.") 35 "This version of Tramp.")
36 36
37;;;###tramp-autoload 37;;;###tramp-autoload
@@ -44,7 +44,7 @@
44 (= emacs-major-version 21) 44 (= emacs-major-version 21)
45 (>= emacs-minor-version 4))) 45 (>= emacs-minor-version 4)))
46 "ok" 46 "ok"
47 (format "Tramp 2.2.9 is not fit for %s" 47 (format "Tramp 2.2.9-24.4 is not fit for %s"
48 (when (string-match "^.*$" (emacs-version)) 48 (when (string-match "^.*$" (emacs-version))
49 (match-string 0 (emacs-version))))))) 49 (match-string 0 (emacs-version)))))))
50 (unless (string-match "\\`ok\\'" x) (error "%s" x))) 50 (unless (string-match "\\`ok\\'" x) (error "%s" x)))