Commit 493ce45c authored by Michael Albinus's avatar Michael Albinus
Browse files

Sync with Tramp 2.2.10.

* lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Improve messages.
(tramp-adb-maybe-open-connection): Don't set
`tramp-current-*' variables.

* lisp/net/tramp-cache.el (tramp-flush-file-function): Do not flush
file properties of temporary buffers.

* lisp/net/tramp-ftp.el (top): Remove special handling for URL syntax.

* lisp/net/tramp-gvfs.el (tramp-gvfs-methods) <sftp>: Add.
(tramp-gvfs-handle-delete-file): Flush file
properties, not directory properties.
(tramp-gvfs-handle-file-attributes): Use `string-to-number' when
reading "unix::mode".
(tramp-gvfs-handle-file-name-all-completions):
Use "-h" option for "gvfs-ls".
(tramp-gvfs-url-file-name): `user' and `localname' could be nil.
(tramp-gvfs-send-command): Simplify traces.

* lisp/net/tramp-sh.el (vc-handled-backends, vc-bzr-program)
(vc-git-program, vc-hg-program): Declare.
(tramp-methods) <sftp>: Remove.  It has never worked satisfactorily.
(tramp-methods) <nc>: Add new method.
(tramp-methods) <telnet>: Redirect stderr to "/dev/null".
(tramp-methods) <plink, plinkx, pscp, psftp>: Improve
`tramp-login-args'.
(tramp-default-user-alist): Add "nc".
(top): Remove completion function for "sftp".  Add completion
functions for "nc" and "psftp".
(tramp-do-copy-or-rename-file-out-of-band): Tweak docstring.
Implement support for "nc" method.
(tramp-sh-handle-expand-file-name, tramp-local-coding-commands)
(tramp-remote-coding-commands, tramp-call-local-coding-command):
Tweak docstring.
(tramp-sh-handle-write-region): Tweak error message.
(tramp-sh-handle-vc-registered): Remove backends when the remote
binary does not exist.
(tramp-find-inline-encoding): Do not raise an error.
(tramp-make-copy-program-file-name): Tweak docstring.  Handle also
the "nc" case.  Quote result also locally.

* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-set-file-acl): Use `start-process'.
(tramp-smb-handle-insert-directory): Use progress reporter.
(tramp-smb-handle-rename-file): Flush also file properties of
FILENAME.

* lisp/net/tramp.el (tramp-methods): Tweak docstring.
(tramp-handle-file-accessible-directory-p): Check for
`file-readable-p' instead of `file-executable-p'.
(tramp-check-cached-permissions): Use
`tramp-compat-file-attributes'.
(tramp-call-process): Add new argument VEC.  Adapt callees in all
tramp*.el files.

* lisp/net/trampver.el: Update release number.
parent 6e71bf16
......@@ -609,10 +609,10 @@ But handle the case, if the \"test\" command is not available."
'write-region
(list start end tmpfile append 'no-message lockname confirm))
(with-tramp-progress-reporter
v 3 (format "Moving tmp file %s to %s" tmpfile filename)
v 3 (format "Moving tmp file `%s' to `%s'" tmpfile filename)
(unwind-protect
(when (tramp-adb-execute-adb-command v "push" tmpfile localname)
(tramp-error v 'file-error "Cannot write: `%s' filename"))
(tramp-error v 'file-error "Cannot write: `%s'" filename))
(delete-file tmpfile)))
(when (or (eq visit t) (stringp visit))
......@@ -998,7 +998,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(with-temp-buffer
(prog1
(unless
(zerop (apply 'tramp-call-process tramp-adb-program nil t nil args))
(zerop
(apply 'tramp-call-process vec tramp-adb-program nil t nil args))
(buffer-string))
(tramp-message vec 6 "%s" (buffer-string)))))
......@@ -1107,10 +1108,7 @@ connection if a previous connection has died for some reason."
(and p (processp p) (memq (process-status p) '(run open)))
(save-match-data
(when (and p (processp p)) (delete-process p))
(setq tramp-current-method (tramp-file-name-method vec)
tramp-current-user (tramp-file-name-user vec)
tramp-current-host (tramp-file-name-host vec)
devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))
(setq devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))
(if (not devices)
(tramp-error vec 'file-error "No device connected"))
(if (and (> (length host) 0) (not (member host devices)))
......
......@@ -203,13 +203,15 @@ Remove also properties of all files in subdirectories."
;; not show proper directory contents when a file has been copied or
;; deleted before.
(defun tramp-flush-file-function ()
"Flush all Tramp cache properties from `buffer-file-name'."
(let ((bfn (if (stringp (buffer-file-name))
(buffer-file-name)
default-directory)))
(when (tramp-tramp-file-p bfn)
(with-parsed-tramp-file-name bfn nil
(tramp-flush-file-property v localname)))))
"Flush all Tramp cache properties from `buffer-file-name'.
This is suppressed for temporary buffers."
(unless (string-match "^ \\*temp\\*" (or (buffer-name) ""))
(let ((bfn (if (stringp (buffer-file-name))
(buffer-file-name)
default-directory)))
(when (tramp-tramp-file-p bfn)
(with-parsed-tramp-file-name bfn nil
(tramp-flush-file-property v localname))))))
(add-hook 'before-revert-hook 'tramp-flush-file-function)
(add-hook 'eshell-pre-command-hook 'tramp-flush-file-function)
......
......@@ -120,17 +120,6 @@ present for backward compatibility."
tramp-ftp-method
'((tramp-parse-netrc "~/.netrc"))))
;; If there is URL syntax, `substitute-in-file-name' needs special
;; handling.
(put 'substitute-in-file-name 'ange-ftp 'tramp-handle-substitute-in-file-name)
(add-hook 'tramp-ftp-unload-hook
(lambda ()
(setplist 'substitute-in-file-name
(delete 'ange-ftp
(delete 'tramp-handle-substitute-in-file-name
(symbol-plist
'substitute-in-file-name))))))
;;;###tramp-autoload
(defun tramp-ftp-file-name-handler (operation &rest args)
"Invoke the Ange-FTP handler for OPERATION.
......
......@@ -49,14 +49,14 @@
;; The customer option `tramp-gvfs-methods' contains the list of
;; supported connection methods. Per default, these are "dav",
;; "davs", "obex" and "synce". Note that with "obex" it might be
;; necessary to pair with the other bluetooth device, if it hasn't
;; "davs", "obex", "sftp" and "synce". Note that with "obex" it might
;; be necessary to pair with the other bluetooth device, if it hasn't
;; been done already. There might be also some few seconds delay in
;; discovering available bluetooth devices.
;; Other possible connection methods are "ftp", "sftp" and "smb".
;; When one of these methods is added to the list, the remote access
;; for that method is performed via GVFS instead of the native Tramp
;; Other possible connection methods are "ftp" and "smb". When one of
;; these methods is added to the list, the remote access for that
;; method is performed via GVFS instead of the native Tramp
;; implementation.
;; GVFS offers even more connection methods. The complete list of
......@@ -110,7 +110,7 @@
(require 'custom))
;;;###tramp-autoload
(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "sftp" "synce")
"List of methods for remote files, accessed with GVFS."
:group 'tramp
:version "23.2"
......@@ -661,7 +661,7 @@ is no information where to trace the message.")
"Like `delete-file' for Tramp files."
(with-parsed-tramp-file-name filename nil
(tramp-flush-file-property v (file-name-directory localname))
(tramp-flush-directory-property v localname)
(tramp-flush-file-property v localname)
(unless
(tramp-gvfs-send-command
v (if (and trash delete-by-moving-to-trash) "gvfs-trash" "gvfs-rm")
......@@ -794,7 +794,8 @@ is no information where to trace the message.")
(goto-char (point-min))
(setq res-filemodes
(if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t)
(tramp-file-mode-from-int (match-string 1))
(tramp-file-mode-from-int
(string-to-number (match-string 1)))
(if dirp "drwx------" "-rwx------")))
;; ... inode and device
(goto-char (point-min))
......@@ -899,7 +900,7 @@ is no information where to trace the message.")
entry)
;; Get a list of directories and files.
(tramp-gvfs-send-command
v "gvfs-ls" (tramp-gvfs-url-file-name directory))
v "gvfs-ls" "-h" (tramp-gvfs-url-file-name directory))
;; Now grab the output.
(with-temp-buffer
......@@ -1118,9 +1119,9 @@ is no information where to trace the message.")
(setq user
(concat (match-string 2 user) ";" (match-string 1 user))))
(url-parse-make-urlobj
method (url-hexify-string user) nil
method (and user (url-hexify-string user)) nil
(tramp-file-name-real-host v) (tramp-file-name-port v)
(url-hexify-string localname) nil nil t))
(and localname (url-hexify-string localname)) nil nil t))
(url-parse-make-urlobj
"file" nil nil nil nil
(url-hexify-string (file-truename filename)) nil nil t))))
......@@ -1555,14 +1556,10 @@ connection if a previous connection has died for some reason."
"Send the COMMAND with its ARGS to connection VEC.
COMMAND is usually a command from the gvfs-* utilities.
`call-process' is applied, and it returns `t' if the return code is zero."
(let (result)
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-gvfs-maybe-open-connection vec)
(erase-buffer)
(tramp-message vec 6 "%s %s" command (mapconcat 'identity args " "))
(setq result (apply 'tramp-call-process command nil t nil args))
(tramp-message vec 6 "\n%s" (buffer-string))
(zerop result))))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-gvfs-maybe-open-connection vec)
(erase-buffer)
(zerop (apply 'tramp-call-process vec command nil t nil args))))
;; D-Bus BLUEZ functions.
......@@ -1671,7 +1668,7 @@ be used."
(list user host)))
(zeroconf-list-services "_webdav._tcp")))
;; Add completion function for DAV and DAVS methods.
;; Add completion function for SFTP, DAV and DAVS methods.
(when (and tramp-gvfs-enabled
(member zeroconf-service-avahi (dbus-list-known-names :system)))
(zeroconf-init tramp-gvfs-zeroconf-domain)
......
This diff is collapsed.
......@@ -447,8 +447,7 @@ pass to the OPERATION."
(expand-file-name
tramp-temp-name-prefix
(tramp-compat-temporary-file-directory))))
(args (list tramp-smb-program
(concat "//" real-host "/" share) "-E")))
(args (list (concat "//" real-host "/" share) "-E")))
(if (not (zerop (length real-user)))
(setq args (append args (list "-U" real-user)))
......@@ -495,10 +494,11 @@ pass to the OPERATION."
;; Use an asynchronous processes. By this,
;; password can be handled.
(let* ((default-directory tmpdir)
(p (start-process-shell-command
(p (apply
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
(mapconcat 'identity args " "))))
tramp-smb-program args)))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
......@@ -938,99 +938,100 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(setq filename (file-name-as-directory filename))
(setq filename (directory-file-name filename)))
(with-parsed-tramp-file-name filename nil
(save-match-data
(let ((base (file-name-nondirectory filename))
;; We should not destroy the cache entry.
(entries (copy-sequence
(tramp-smb-get-file-entries
(file-name-directory filename)))))
(when wildcard
(string-match "\\." base)
(setq base (replace-match "\\\\." nil nil base))
(string-match "\\*" base)
(setq base (replace-match ".*" nil nil base))
(string-match "\\?" base)
(setq base (replace-match ".?" nil nil base)))
;; Filter entries.
(setq entries
(delq
nil
(if (or wildcard (zerop (length base)))
;; Check for matching entries.
(mapcar
(lambda (x)
(when (string-match
(format "^%s" base) (nth 0 x))
x))
entries)
;; We just need the only and only entry FILENAME.
(list (assoc base entries)))))
;; Sort entries.
(setq entries
(sort
entries
(lambda (x y)
(if (string-match "t" switches)
;; Sort by date.
(tramp-time-less-p (nth 3 y) (nth 3 x))
;; Sort by name.
(string-lessp (nth 0 x) (nth 0 y))))))
;; Handle "-F" switch.
(when (string-match "F" switches)
(with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
(save-match-data
(let ((base (file-name-nondirectory filename))
;; We should not destroy the cache entry.
(entries (copy-sequence
(tramp-smb-get-file-entries
(file-name-directory filename)))))
(when wildcard
(string-match "\\." base)
(setq base (replace-match "\\\\." nil nil base))
(string-match "\\*" base)
(setq base (replace-match ".*" nil nil base))
(string-match "\\?" base)
(setq base (replace-match ".?" nil nil base)))
;; Filter entries.
(setq entries
(delq
nil
(if (or wildcard (zerop (length base)))
;; Check for matching entries.
(mapcar
(lambda (x)
(when (string-match
(format "^%s" base) (nth 0 x))
x))
entries)
;; We just need the only and only entry FILENAME.
(list (assoc base entries)))))
;; Sort entries.
(setq entries
(sort
entries
(lambda (x y)
(if (string-match "t" switches)
;; Sort by date.
(tramp-time-less-p (nth 3 y) (nth 3 x))
;; Sort by name.
(string-lessp (nth 0 x) (nth 0 y))))))
;; Handle "-F" switch.
(when (string-match "F" switches)
(mapc
(lambda (x)
(when (not (zerop (length (car x))))
(cond
((char-equal ?d (string-to-char (nth 1 x)))
(setcar x (concat (car x) "/")))
((char-equal ?x (string-to-char (nth 1 x)))
(setcar x (concat (car x) "*"))))))
entries))
;; Print entries.
(mapc
(lambda (x)
(when (not (zerop (length (car x))))
(cond
((char-equal ?d (string-to-char (nth 1 x)))
(setcar x (concat (car x) "/")))
((char-equal ?x (string-to-char (nth 1 x)))
(setcar x (concat (car x) "*"))))))
entries))
;; Print entries.
(mapc
(lambda (x)
(when (not (zerop (length (nth 0 x))))
(when (string-match "l" switches)
(let ((attr
(when (tramp-smb-get-stat-capability v)
(ignore-errors
(file-attributes filename 'string)))))
(when (not (zerop (length (nth 0 x))))
(when (string-match "l" switches)
(let ((attr
(when (tramp-smb-get-stat-capability v)
(ignore-errors
(file-attributes filename 'string)))))
(insert
(format
"%10s %3d %-8s %-8s %8s %s "
(or (nth 8 attr) (nth 1 x)) ; mode
(or (nth 1 attr) 1) ; inode
(or (nth 2 attr) "nobody") ; uid
(or (nth 3 attr) "nogroup") ; gid
(or (nth 7 attr) (nth 2 x)) ; size
(format-time-string
(if (tramp-time-less-p
(tramp-time-subtract (current-time) (nth 3 x))
tramp-half-a-year)
"%b %e %R"
"%b %e %Y")
(nth 3 x)))))) ; date
;; We mark the file name. The inserted name could be
;; from somewhere else, so we use the relative file name
;; of `default-directory'.
(let ((start (point)))
(insert
(format
"%10s %3d %-8s %-8s %8s %s "
(or (nth 8 attr) (nth 1 x)) ; mode
(or (nth 1 attr) 1) ; inode
(or (nth 2 attr) "nobody") ; uid
(or (nth 3 attr) "nogroup") ; gid
(or (nth 7 attr) (nth 2 x)) ; size
(format-time-string
(if (tramp-time-less-p
(tramp-time-subtract (current-time) (nth 3 x))
tramp-half-a-year)
"%b %e %R"
"%b %e %Y")
(nth 3 x)))))) ; date
;; We mark the file name. The inserted name could be
;; from somewhere else, so we use the relative file name
;; of `default-directory'.
(let ((start (point)))
(insert
(format
"%s\n"
(file-relative-name
(expand-file-name
(nth 0 x) (file-name-directory filename))
(when full-directory-p (file-name-directory filename)))))
(put-text-property start (1- (point)) 'dired-filename t))
(forward-line)
(beginning-of-line)))
entries)))))
"%s\n"
(file-relative-name
(expand-file-name
(nth 0 x) (file-name-directory filename))
(when full-directory-p (file-name-directory filename)))))
(put-text-property start (1- (point)) 'dired-filename t))
(forward-line)
(beginning-of-line)))
entries))))))
(defun tramp-smb-handle-make-directory (dir &optional parents)
"Like `make-directory' for Tramp files."
......@@ -1277,6 +1278,8 @@ target of the symlink differ."
;; We must also flush the cache of the directory, because
;; `file-attributes' reads the values from there.
(tramp-flush-file-property v1 (file-name-directory v1-localname))
(tramp-flush-file-property v1 v1-localname)
(tramp-flush-file-property v2 (file-name-directory v2-localname))
(tramp-flush-file-property v2 v2-localname)
(unless (tramp-smb-get-share v2)
......@@ -1349,7 +1352,7 @@ target of the symlink differ."
;; Use an asynchronous processes. By this, password can
;; be handled.
(let ((p (apply
'start-process-shell-command
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
......
......@@ -240,7 +240,7 @@ pair of the form (KEY VALUE). The following KEYs are defined:
tamper the process output.
* `tramp-copy-program'
This specifies the name of the program to use for remotely copying
the file; this might be the absolute filename of rcp or the name of
the file; this might be the absolute filename of scp or the name of
a workalike program. It is always applied on the local host.
* `tramp-copy-args'
This specifies the list of parameters to pass to the above mentioned
......@@ -248,6 +248,13 @@ pair of the form (KEY VALUE). The following KEYs are defined:
* `tramp-copy-env'
A list of environment variables and their values, which will
be set when calling `tramp-copy-program'.
* `tramp-remote-copy-program'
The listener program to be applied on remote side, if needed.
* `tramp-remote-copy-args'
The list of parameters to pass to the listener program, the hints
for `tramp-login-args' also apply here. Additionally, \"%r\" could
be used here and in `tramp-copy-args'. It denotes a randomly
chosen port for the remote listener.
* `tramp-copy-keep-date'
This specifies whether the copying program when the preserves the
timestamp of the original file.
......@@ -275,7 +282,7 @@ pair of the form (KEY VALUE). The following KEYs are defined:
What does all this mean? Well, you should specify `tramp-login-program'
for all methods; this program is used to log in to the remote site. Then,
there are two ways to actually transfer the files between the local and the
remote side. One way is using an additional rcp-like program. If you want
remote side. One way is using an additional scp-like program. If you want
to do this, set `tramp-copy-program' in the method.
Another possibility for file transfer is inline transfer, i.e. the
......@@ -1762,7 +1769,7 @@ Example:
(and (memq system-type '(cygwin windows-nt))
(zerop
(tramp-call-process
"reg" nil nil nil "query" (nth 1 (car v)))))
v "reg" nil nil nil "query" (nth 1 (car v)))))
;; Configuration file.
(file-exists-p (nth 1 (car v)))))
(setq r (delete (car v) r)))
......@@ -2816,7 +2823,7 @@ User is always nil."
(if (memq system-type '(windows-nt))
(with-temp-buffer
(when (zerop (tramp-call-process
"reg" nil t nil "query" registry-or-dirname))
nil "reg" nil t nil "query" registry-or-dirname))
(goto-char (point-min))
(loop while (not (eobp)) collect
(tramp-parse-putty-group registry-or-dirname))))
......@@ -2895,7 +2902,7 @@ User is always nil."
(defun tramp-handle-file-accessible-directory-p (filename)
"Like `file-accessible-directory-p' for Tramp files."
(and (file-directory-p filename)
(file-executable-p filename)))
(file-readable-p filename)))
(defun tramp-handle-file-exists-p (filename)
"Like `file-exists-p' for Tramp files."
......@@ -3906,7 +3913,7 @@ be granted."
(tramp-get-file-property
vec (tramp-file-name-localname vec)
(concat "file-attributes-" suffix) nil)
(file-attributes
(tramp-compat-file-attributes
(tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
......@@ -4118,14 +4125,16 @@ ALIST is of the form ((FROM . TO) ...)."
;;; Compatibility functions section:
(defun tramp-call-process
(program &optional infile destination display &rest args)
(vec program &optional infile destination display &rest args)
"Calls `call-process' on the local host.
This is needed because for some Emacs flavors Tramp has
defadvised `call-process' to behave like `process-file'. The
Lisp error raised when PROGRAM is nil is trapped also, returning 1.
Furthermore, traces are written with verbosity of 6."
(let ((v (vector tramp-current-method tramp-current-user tramp-current-host
nil nil))
(let ((v (or vec
(vector tramp-current-method tramp-current-user
tramp-current-host nil nil)))
(destination (if (eq destination t) (current-buffer) destination))
result)
(tramp-message
v 6 "`%s %s' %s %s"
......
......@@ -31,7 +31,7 @@
;; should be changed only there.
;;;###tramp-autoload
(defconst tramp-version "2.2.9-24.4"
(defconst tramp-version "2.2.10"
"This version of Tramp.")
;;;###tramp-autoload
......@@ -44,7 +44,7 @@
(= emacs-major-version 21)
(>= emacs-minor-version 4)))
"ok"
(format "Tramp 2.2.9-24.4 is not fit for %s"
(format "Tramp 2.2.10 is not fit for %s"
(when (string-match "^.*$" (emacs-version))
(match-string 0 (emacs-version)))))))
(unless (string-match "\\`ok\\'" x) (error "%s" x)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment