Sync with Tramp 2.4.0-pre

* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.4.0-pre".

* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
Use `tramp-handle-file-directory-p'.
(tramp-adb-parse-device-names)
(tramp-adb-handle-expand-file-name)
(tramp-adb-handle-file-truename, tramp-adb-handle-process-file):
Adapt `tramp-make-tramp-file-name' call.
(tramp-adb-handle-file-directory-p): Remove.
(tramp-adb-maybe-open-connection): Do not set
tramp-current-*.

* lisp/net/tramp-cache.el (tramp-get-hash-table):
Adapt `tramp-make-tramp-file-name' call.

* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Do not set
tramp-current-*.

* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Use `tramp-handle-file-directory-p'.
(tramp-gvfs-dbus-event-error): Trace with verbosity 6.
(tramp-gvfs-do-copy-or-rename-file): Use `file-truename'.
(tramp-gvfs-handle-file-directory-p): Remove.
(tramp-gvfs-handler-askpassword): Do not set tramp-current-*.

* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-start-file-process)
(tramp-maybe-open-connection, tramp-get-remote-path): Do not
set tramp-current-*.
(tramp-maybe-open-connection): Set "password-vector" property.

* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Use `tramp-handle-file-accessible-directory-p' and
`tramp-handle-file-directory-p'.
(tramp-smb-handle-copy-directory, tramp-smb-handle-file-acl)
(tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection): Do not set tramp-current-*.
(tramp-smb-handle-file-directory-p): Remove.
(tramp-smb-handle-make-symbolic-link):
Use `tramp-get-connection-buffer' rather than `buffer-name'.

* lisp/net/tramp.el (tramp-current-method, tramp-current-user)
(tramp-current-domain, tramp-current-host)
(tramp-current-port): Remove.
(tramp-dissect-file-name): No special handling of localname anymore.
(tramp-make-tramp-file-name): Reimplemnt with new signature.
(tramp-completion-make-tramp-file-name): Fix docstring.
(tramp-get-buffer, tramp-handle-file-name-as-directory)
(tramp-handle-file-name-directory)
(tramp-check-cached-permissions, tramp-local-host-p)
(tramp-get-remote-tmpdir, tramp-clear-passwd):
Adapt `tramp-make-tramp-file-name' call.
(tramp-completion-handle-file-name-all-completions)
(tramp-action-login, tramp-read-passwd): Do not set
tramp-current-*.
(tramp-handle-file-directory-p): New defun.
(tramp-handle-verify-visited-file-modtime): Remove superfluous
`with-parsed-tramp-file-name'.
(tramp-process-actions, tramp-read-passwd):
Use "password-vector" property.
(tramp-call-process, tramp-call-process-region): No special
setting of vec.
(tramp-read-passwd): Handle "login-as" property.

* test/lisp/net/tramp-tests.el (tramp-test21-file-links):
Special code for "smb".
This commit is contained in:
Michael Albinus 2017-12-09 13:22:52 +01:00
parent b067fa1f7d
commit 34bedf5d0b
10 changed files with 237 additions and 351 deletions

View file

@ -228,10 +228,10 @@ See `tramp-actions-before-shell' for more info.")
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-smb-handle-expand-file-name)
(file-accessible-directory-p . tramp-smb-handle-file-directory-p)
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
(file-acl . tramp-smb-handle-file-acl)
(file-attributes . tramp-smb-handle-file-attributes)
(file-directory-p . tramp-smb-handle-file-directory-p)
(file-directory-p . tramp-handle-file-directory-p)
(file-file-equal-p . tramp-handle-file-equal-p)
(file-executable-p . tramp-handle-file-exists-p)
(file-exists-p . tramp-handle-file-exists-p)
@ -449,13 +449,6 @@ pass to the OPERATION."
(if (not (file-directory-p newname))
(make-directory newname parents))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(let* ((share (tramp-smb-get-share v))
(localname (file-name-as-directory
(replace-regexp-in-string
@ -739,62 +732,56 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(defun tramp-smb-handle-file-acl (filename)
"Like `file-acl' for Tramp files."
(with-parsed-tramp-file-name filename nil
(with-tramp-file-property v localname "file-acl"
(when (executable-find tramp-smb-acl-program)
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(ignore-errors
(with-parsed-tramp-file-name filename nil
(with-tramp-file-property v localname "file-acl"
(when (executable-find tramp-smb-acl-program)
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E")))
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E")))
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(setq args (append args (list "-N"))))
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(setq args (append args (list "-N"))))
(when domain (setq args (append args (list "-W" domain))))
(when port (setq args (append args (list "-p" port))))
(when tramp-smb-conf
(setq args (append args (list "-s" tramp-smb-conf))))
(setq
args
(append args (list (tramp-unquote-shell-quote-argument localname)
"2>/dev/null")))
(when domain (setq args (append args (list "-W" domain))))
(when port (setq args (append args (list "-p" port))))
(when tramp-smb-conf
(setq args (append args (list "-s" tramp-smb-conf))))
(setq
args
(append args (list (tramp-unquote-shell-quote-argument localname)
"2>/dev/null")))
(unwind-protect
(with-temp-buffer
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
(tramp-set-connection-property
v "process-buffer" (current-buffer))
(unwind-protect
(with-temp-buffer
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
(tramp-set-connection-property
v "process-buffer" (current-buffer))
;; Use an asynchronous process. By this, password can
;; be handled.
(let ((p (apply
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
;; Use an asynchronous processes. By this, password
;; can be handled.
(let ((p (apply
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
(when (> (point-max) (point-min))
(substring-no-properties (buffer-string)))))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
(when (> (point-max) (point-min))
(substring-no-properties (buffer-string)))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil)))))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil))))))))
(defun tramp-smb-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files."
@ -911,13 +898,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(list id link uid gid atime mtime ctime size mode nil inode
(tramp-get-device vec))))))))
(defun tramp-smb-handle-file-directory-p (filename)
"Like `file-directory-p' for Tramp files."
(and (file-exists-p filename)
(eq ?d
(aref (tramp-compat-file-attribute-modes (file-attributes filename))
0))))
(defun tramp-smb-handle-file-local-copy (filename)
"Like `file-local-copy' for Tramp files."
(with-parsed-tramp-file-name (file-truename filename) nil
@ -1222,7 +1202,7 @@ component is used as the target of the symlink."
(tramp-error
v 'file-error
"error with make-symbolic-link, see buffer `%s' for details"
(buffer-name)))))))
(tramp-get-connection-buffer v)))))))
(defun tramp-smb-handle-process-file
(program &optional infile destination display &rest args)
@ -1403,15 +1383,9 @@ component is used as the target of the symlink."
"Like `set-file-acl' for Tramp files."
(ignore-errors
(with-parsed-tramp-file-name filename nil
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(tramp-set-file-property v localname "file-acl" 'undef)
(tramp-set-file-property v localname "file-acl" 'undef)
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
@ -1971,13 +1945,6 @@ If ARGUMENT is non-nil, use it as argument for
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method tramp-smb-method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(condition-case err
(let (tramp-message-show-message)
;; Play login scenario.