Code cleanup.
* net/tramp.el (tramp-debug-message): Do not check for connection buffer. (tramp-message): Use "vector" connection property. * net/tramp.el (tramp-rfn-eshadow-update-overlay) (tramp-equal-remote, tramp-eshell-directory-change) * net/tramp-adb.el (tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file) * net/tramp-cmds.el (tramp-list-remote-buffers) (tramp-cleanup-connection, tramp-cleanup-this-connection) * net/tramp-compat.el (tramp-compat-process-running-p) * net/tramp-ftp.el (tramp-ftp-file-name-handler) * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file) (tramp-gvfs-handle-rename-file) * net/tramp-sh.el (tramp-sh-handle-set-file-times) (tramp-set-file-uid-gid) * net/tramp-smb.el (tramp-smb-handle-copy-file) (tramp-smb-handle-rename-file): Use `tramp-tramp-file-p' instead of `file-remote-p'. * net/tramp.el (tramp-connectable-p, tramp-handle-file-remote-p) * net/tramp-gw.el (tramp-gw-gw-proc-sentinel) (tramp-gw-aux-proc-sentinel, tramp-gw-process-filter) (tramp-gw-open-network-stream): Suppress unrelated traces. * net/tramp-adb.el (tramp-adb-maybe-open-connection) * net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch) * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) * net/tramp-smb.el (tramp-smb-maybe-open-connection): Set "vector" connection property. * net/tramp-cache.el (top): Suppress traces when reading presistency file. * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Refactor common code. Improve debug message. (tramp-maybe-open-connection) * net/tramp-smb.el (tramp-smb-call-winexe): Do not request connection buffer too early. * net/tramp-smb.el (tramp-smb-actions-get-acl): New defconst, renamed from `tramp-smb-actions-with-acl'. (tramp-smb-actions-set-acl): New defconst. (tramp-smb-handle-copy-directory) (tramp-smb-action-get-acl): New defun, renamed from `tramp-smb-action-with-acl'. (tramp-smb-action-set-acl): New defun. (tramp-smb-handle-set-file-acl): Rewrite.
This commit is contained in:
parent
642eb8b6af
commit
4c1f03efec
11 changed files with 260 additions and 173 deletions
|
|
@ -1,3 +1,56 @@
|
|||
2013-10-17 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
Code cleanup.
|
||||
|
||||
* net/tramp.el (tramp-debug-message): Do not check for connection
|
||||
buffer.
|
||||
(tramp-message): Use "vector" connection property.
|
||||
|
||||
* net/tramp.el (tramp-rfn-eshadow-update-overlay)
|
||||
(tramp-equal-remote, tramp-eshell-directory-change)
|
||||
* net/tramp-adb.el (tramp-adb-handle-copy-file)
|
||||
(tramp-adb-handle-rename-file)
|
||||
* net/tramp-cmds.el (tramp-list-remote-buffers)
|
||||
(tramp-cleanup-connection, tramp-cleanup-this-connection)
|
||||
* net/tramp-compat.el (tramp-compat-process-running-p)
|
||||
* net/tramp-ftp.el (tramp-ftp-file-name-handler)
|
||||
* net/tramp-gvfs.el (tramp-gvfs-handle-copy-file)
|
||||
(tramp-gvfs-handle-rename-file)
|
||||
* net/tramp-sh.el (tramp-sh-handle-set-file-times)
|
||||
(tramp-set-file-uid-gid)
|
||||
* net/tramp-smb.el (tramp-smb-handle-copy-file)
|
||||
(tramp-smb-handle-rename-file): Use `tramp-tramp-file-p' instead
|
||||
of `file-remote-p'.
|
||||
|
||||
* net/tramp.el (tramp-connectable-p, tramp-handle-file-remote-p)
|
||||
* net/tramp-gw.el (tramp-gw-gw-proc-sentinel)
|
||||
(tramp-gw-aux-proc-sentinel, tramp-gw-process-filter)
|
||||
(tramp-gw-open-network-stream): Suppress unrelated traces.
|
||||
|
||||
* net/tramp-adb.el (tramp-adb-maybe-open-connection)
|
||||
* net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch)
|
||||
* net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
|
||||
* net/tramp-smb.el (tramp-smb-maybe-open-connection): Set "vector"
|
||||
connection property.
|
||||
|
||||
* net/tramp-cache.el (top): Suppress traces when reading
|
||||
presistency file.
|
||||
|
||||
* net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
|
||||
Refactor common code. Improve debug message.
|
||||
(tramp-maybe-open-connection)
|
||||
* net/tramp-smb.el (tramp-smb-call-winexe): Do not request
|
||||
connection buffer too early.
|
||||
|
||||
* net/tramp-smb.el (tramp-smb-actions-get-acl): New defconst, renamed
|
||||
from `tramp-smb-actions-with-acl'.
|
||||
(tramp-smb-actions-set-acl): New defconst.
|
||||
(tramp-smb-handle-copy-directory)
|
||||
(tramp-smb-action-get-acl): New defun, renamed from
|
||||
`tramp-smb-action-with-acl'.
|
||||
(tramp-smb-action-set-acl): New defun.
|
||||
(tramp-smb-handle-set-file-acl): Rewrite.
|
||||
|
||||
2013-10-17 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* indent.el (indent-rigidly): Fix 2013-10-08 change. (Bug#15635)
|
||||
|
|
|
|||
|
|
@ -662,7 +662,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(if (file-directory-p filename)
|
||||
(tramp-file-name-handler 'copy-directory filename newname keep-date t)
|
||||
(with-tramp-progress-reporter
|
||||
(tramp-dissect-file-name (if (file-remote-p filename) filename newname))
|
||||
(tramp-dissect-file-name
|
||||
(if (tramp-tramp-file-p filename) filename newname))
|
||||
0 (format "Copying %s to %s" filename newname)
|
||||
|
||||
(let ((tmpfile (file-local-copy filename)))
|
||||
|
|
@ -704,7 +705,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
newname (expand-file-name newname))
|
||||
|
||||
(with-parsed-tramp-file-name
|
||||
(if (file-remote-p filename) filename newname) nil
|
||||
(if (tramp-tramp-file-p filename) filename newname) nil
|
||||
(with-tramp-progress-reporter
|
||||
v 0 (format "Renaming %s to %s" newname filename)
|
||||
|
||||
|
|
@ -1134,6 +1135,7 @@ connection if a previous connection has died for some reason."
|
|||
(tramp-adb-wait-for-output p 30)
|
||||
(unless (eq 'run (process-status p))
|
||||
(tramp-error vec 'file-error "Terminated!"))
|
||||
(tramp-set-connection-property p "vector" vec)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
|
||||
;; Check whether the properties have been changed. If
|
||||
|
|
|
|||
|
|
@ -405,6 +405,7 @@ for all methods. Resulting data are derived from connection history."
|
|||
(with-temp-buffer
|
||||
(insert-file-contents tramp-persistency-file-name)
|
||||
(let ((list (read (current-buffer)))
|
||||
(tramp-verbose 0)
|
||||
element key item)
|
||||
(while (setq element (pop list))
|
||||
(setq key (pop element))
|
||||
|
|
|
|||
|
|
@ -48,10 +48,7 @@
|
|||
nil
|
||||
(mapcar
|
||||
(lambda (x)
|
||||
(with-current-buffer x
|
||||
(when (and (stringp default-directory)
|
||||
(file-remote-p default-directory))
|
||||
x)))
|
||||
(with-current-buffer x (when (tramp-tramp-file-p default-directory) x)))
|
||||
(buffer-list))))
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
|
@ -81,8 +78,7 @@ When called interactively, a Tramp connection has to be selected."
|
|||
(completing-read
|
||||
"Enter Tramp connection: " connections nil t
|
||||
(try-completion "" connections)))
|
||||
(when (and name (file-remote-p name))
|
||||
(with-parsed-tramp-file-name name nil v))))
|
||||
(and (tramp-tramp-file-p name) (tramp-dissect-file-name name))))
|
||||
nil nil))
|
||||
|
||||
(if (not vec)
|
||||
|
|
@ -113,8 +109,7 @@ When called interactively, a Tramp connection has to be selected."
|
|||
(defun tramp-cleanup-this-connection ()
|
||||
"Flush all connection related objects of the current buffer's connection."
|
||||
(interactive)
|
||||
(and (stringp default-directory)
|
||||
(file-remote-p default-directory)
|
||||
(and (tramp-tramp-file-p default-directory)
|
||||
(tramp-cleanup-connection
|
||||
(tramp-dissect-file-name default-directory 'noexpand))))
|
||||
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ element is not omitted."
|
|||
|
||||
;; Fallback, if there is no Lisp support yet.
|
||||
(t (let ((default-directory
|
||||
(if (file-remote-p default-directory)
|
||||
(if (tramp-tramp-file-p default-directory)
|
||||
(tramp-compat-temporary-file-directory)
|
||||
default-directory))
|
||||
(unix95 (getenv "UNIX95"))
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ pass to the OPERATION."
|
|||
;; We must copy it locally first, because there is no place in
|
||||
;; ange-ftp for correct handling.
|
||||
((and (memq operation '(copy-file rename-file))
|
||||
(file-remote-p (cadr args))
|
||||
(tramp-tramp-file-p (cadr args))
|
||||
(not (tramp-ftp-file-name-p (cadr args))))
|
||||
(let* ((filename (car args))
|
||||
(newname (cadr args))
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ is no information where to trace the message.")
|
|||
nil v 'file-error
|
||||
"Copying failed, see buffer `%s' for details." (buffer-name)))))
|
||||
|
||||
(when (file-remote-p newname)
|
||||
(when (tramp-tramp-file-p newname)
|
||||
(with-parsed-tramp-file-name newname nil
|
||||
(tramp-flush-file-property v (file-name-directory localname))
|
||||
(tramp-flush-file-property v localname))))))
|
||||
|
|
@ -938,6 +938,9 @@ is no information where to trace the message.")
|
|||
(if (not (processp p))
|
||||
(tramp-error
|
||||
v 'file-notify-error "gvfs-monitor-file failed to start")
|
||||
(tramp-message
|
||||
v 6 "Run `%s', %S" (mapconcat 'identity (process-command p) " ") p)
|
||||
(tramp-set-connection-property p "vector" v)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(set-process-filter p 'tramp-gvfs-file-gvfs-monitor-file-process-filter)
|
||||
(with-current-buffer (process-buffer p)
|
||||
|
|
@ -1061,12 +1064,12 @@ is no information where to trace the message.")
|
|||
nil v 'file-error
|
||||
"Renaming failed, see buffer `%s' for details." (buffer-name)))))
|
||||
|
||||
(when (file-remote-p filename)
|
||||
(when (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(tramp-flush-file-property v (file-name-directory localname))
|
||||
(tramp-flush-file-property v localname)))
|
||||
|
||||
(when (file-remote-p newname)
|
||||
(when (tramp-tramp-file-p newname)
|
||||
(with-parsed-tramp-file-name newname nil
|
||||
(tramp-flush-file-property v (file-name-directory localname))
|
||||
(tramp-flush-file-property v localname))))))
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
(unless (memq (process-status proc) '(run open))
|
||||
(tramp-message
|
||||
tramp-gw-vector 4 "Deleting auxiliary process `%s'" tramp-gw-gw-proc)
|
||||
(let* (tramp-verbose
|
||||
(let* ((tramp-verbose 0)
|
||||
(p (tramp-get-connection-property proc "process" nil)))
|
||||
(when (processp p) (delete-process p)))))
|
||||
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
(tramp-compat-set-process-query-on-exit-flag proc nil)
|
||||
;; We don't want debug messages, because the corresponding debug
|
||||
;; buffer might be undecided.
|
||||
(let (tramp-verbose)
|
||||
(let ((tramp-verbose 0))
|
||||
(tramp-set-connection-property tramp-gw-gw-proc "process" proc)
|
||||
(tramp-set-connection-property proc "process" tramp-gw-gw-proc))
|
||||
;; Set the process-filter functions for both processes.
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
(tramp-gw-process-filter tramp-gw-gw-proc s))))))
|
||||
|
||||
(defun tramp-gw-process-filter (proc string)
|
||||
(let (tramp-verbose)
|
||||
(let ((tramp-verbose 0))
|
||||
(process-send-string
|
||||
(tramp-get-connection-property proc "process" nil) string)))
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ authentication is requested from proxy server, provide it."
|
|||
;; proxies have a timeout of 60". We wait 65" in order to
|
||||
;; receive an answer this case.
|
||||
(ignore-errors
|
||||
(let (tramp-verbose)
|
||||
(let ((tramp-verbose 0))
|
||||
(tramp-wait-for-regexp proc 65 "\r?\n\r?\n")))
|
||||
;; Check return code.
|
||||
(goto-char (point-min))
|
||||
|
|
|
|||
|
|
@ -1300,7 +1300,7 @@ of."
|
|||
|
||||
(defun tramp-sh-handle-set-file-times (filename &optional time)
|
||||
"Like `set-file-times' for Tramp files."
|
||||
(if (file-remote-p filename)
|
||||
(if (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(tramp-flush-file-property v localname)
|
||||
(let ((time (if (or (null time) (equal time '(0 0)))
|
||||
|
|
@ -1339,7 +1339,7 @@ be non-negative integers."
|
|||
;; the majority of cases.
|
||||
;; Don't modify `last-coding-system-used' by accident.
|
||||
(let ((last-coding-system-used last-coding-system-used))
|
||||
(if (file-remote-p filename)
|
||||
(if (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(if (and (zerop (user-uid)) (tramp-local-host-p v))
|
||||
;; If we are root on the local host, we can do it directly.
|
||||
|
|
@ -2323,6 +2323,7 @@ The method used must be an out-of-band method."
|
|||
(tramp-message
|
||||
orig-vec 6 "%s"
|
||||
(mapconcat 'identity (process-command p) " "))
|
||||
(tramp-set-connection-property p "vector" orig-vec)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions
|
||||
p v nil tramp-actions-copy-out-of-band)
|
||||
|
|
@ -2333,7 +2334,8 @@ The method used must be an out-of-band method."
|
|||
(re-search-backward "tramp_exit_status [0-9]+" nil t)
|
||||
(tramp-error
|
||||
orig-vec 'file-error
|
||||
"Couldn't find exit status of `%s'" (process-command p)))
|
||||
"Couldn't find exit status of `%s'"
|
||||
(mapconcat 'identity (process-command p) " ")))
|
||||
(skip-chars-forward "^ ")
|
||||
(unless (zerop (read (current-buffer)))
|
||||
(forward-line -1)
|
||||
|
|
@ -3342,14 +3344,12 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
(setq file-name (expand-file-name file-name))
|
||||
(with-parsed-tramp-file-name file-name nil
|
||||
(let* ((default-directory (file-name-directory file-name))
|
||||
command events filter p)
|
||||
command events filter p sequence)
|
||||
(cond
|
||||
;; gvfs-monitor-dir.
|
||||
((setq command (tramp-get-remote-gvfs-monitor-dir v))
|
||||
(setq filter 'tramp-sh-file-gvfs-monitor-dir-process-filter
|
||||
p (start-file-process
|
||||
"gvfs-monitor-dir" (generate-new-buffer " *gvfs-monitor-dir*")
|
||||
command localname)))
|
||||
sequence `(,command ,localname)))
|
||||
;; inotifywait.
|
||||
((setq command (tramp-get-remote-inotifywait v))
|
||||
(setq filter 'tramp-sh-file-inotifywait-process-filter
|
||||
|
|
@ -3359,18 +3359,27 @@ Fall back to normal file name handler if no Tramp handler exists."
|
|||
"create,modify,move,delete,attrib")
|
||||
((memq 'change flags) "create,modify,move,delete")
|
||||
((memq 'attribute-change flags) "attrib"))
|
||||
p (start-file-process
|
||||
"inotifywait" (generate-new-buffer " *inotifywait*")
|
||||
command "-mq" "-e" events localname)))
|
||||
sequence `(,command "-mq" "-e" ,events ,localname)))
|
||||
;; None.
|
||||
(t (tramp-error
|
||||
v 'file-notify-error
|
||||
"No file notification program found on %s"
|
||||
(file-remote-p file-name))))
|
||||
;; Start process.
|
||||
(setq p (apply
|
||||
'start-file-process
|
||||
(file-name-nondirectory command)
|
||||
(generate-new-buffer
|
||||
(format " *%s*" (file-name-nondirectory command)))
|
||||
sequence))
|
||||
;; Return the process object as watch-descriptor.
|
||||
(if (not (processp p))
|
||||
(tramp-error
|
||||
v 'file-notify-error "`%s' failed to start on remote host" command)
|
||||
v 'file-notify-error
|
||||
"`%s' failed to start on remote host"
|
||||
(mapconcat 'identity sequence " "))
|
||||
(tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p)
|
||||
(tramp-set-connection-property p "vector" v)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(set-process-filter p filter)
|
||||
p))))
|
||||
|
|
@ -4333,10 +4342,6 @@ connection if a previous connection has died for some reason."
|
|||
(condition-case err
|
||||
(unless (and p (processp p) (memq (process-status p) '(run open)))
|
||||
|
||||
;; We call `tramp-get-buffer' in order to get a debug buffer
|
||||
;; for messages from the beginning.
|
||||
(tramp-get-buffer vec)
|
||||
|
||||
;; If `non-essential' is non-nil, don't reopen a new connection.
|
||||
(when (and (boundp 'non-essential) (symbol-value 'non-essential))
|
||||
(throw 'non-essential 'non-essential))
|
||||
|
|
|
|||
|
|
@ -187,11 +187,21 @@ This list is used for tar-like copy of directories.
|
|||
|
||||
See `tramp-actions-before-shell' for more info.")
|
||||
|
||||
(defconst tramp-smb-actions-with-acl
|
||||
(defconst tramp-smb-actions-get-acl
|
||||
'((tramp-password-prompt-regexp tramp-action-password)
|
||||
(tramp-wrong-passwd-regexp tramp-action-permission-denied)
|
||||
(tramp-smb-errors tramp-action-permission-denied)
|
||||
(tramp-process-alive-regexp tramp-smb-action-with-acl))
|
||||
(tramp-process-alive-regexp tramp-smb-action-get-acl))
|
||||
"List of pattern/action pairs.
|
||||
This list is used for smbcacls actions.
|
||||
|
||||
See `tramp-actions-before-shell' for more info.")
|
||||
|
||||
(defconst tramp-smb-actions-set-acl
|
||||
'((tramp-password-prompt-regexp tramp-action-password)
|
||||
(tramp-wrong-passwd-regexp tramp-action-permission-denied)
|
||||
(tramp-smb-errors tramp-action-permission-denied)
|
||||
(tramp-process-alive-regexp tramp-smb-action-set-acl))
|
||||
"List of pattern/action pairs.
|
||||
This list is used for smbcacls actions.
|
||||
|
||||
|
|
@ -481,6 +491,7 @@ pass to the OPERATION."
|
|||
|
||||
(tramp-message
|
||||
v 6 "%s" (mapconcat 'identity (process-command p) " "))
|
||||
(tramp-set-connection-property p "vector" v)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-with-tar)
|
||||
|
||||
|
|
@ -521,7 +532,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(setq filename (expand-file-name filename)
|
||||
newname (expand-file-name newname))
|
||||
(with-tramp-progress-reporter
|
||||
(tramp-dissect-file-name (if (file-remote-p filename) filename newname))
|
||||
(tramp-dissect-file-name
|
||||
(if (tramp-tramp-file-p filename) filename newname))
|
||||
0 (format "Copying %s to %s" filename newname)
|
||||
|
||||
(if (file-directory-p filename)
|
||||
|
|
@ -667,7 +679,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
method user host
|
||||
(tramp-run-real-handler 'expand-file-name (list localname))))))
|
||||
|
||||
(defun tramp-smb-action-with-acl (proc vec)
|
||||
(defun tramp-smb-action-get-acl (proc vec)
|
||||
"Read ACL data from connection buffer."
|
||||
(when (not (memq (process-status proc) '(run open)))
|
||||
;; Accept pending output.
|
||||
|
|
@ -734,9 +746,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
|
||||
(tramp-message
|
||||
v 6 "%s" (mapconcat 'identity (process-command p) " "))
|
||||
(tramp-set-connection-property p "vector" v)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-with-acl)
|
||||
(tramp-message v 6 "\n%s" (buffer-string))
|
||||
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
|
||||
(when (> (point-max) (point-min))
|
||||
(tramp-compat-funcall
|
||||
'substring-no-properties (buffer-string)))))
|
||||
|
|
@ -1225,11 +1237,12 @@ target of the symlink differ."
|
|||
(file-exists-p newname))
|
||||
(tramp-error
|
||||
(tramp-dissect-file-name
|
||||
(if (file-remote-p filename) filename newname))
|
||||
(if (tramp-tramp-file-p filename) filename newname))
|
||||
'file-already-exists newname))
|
||||
|
||||
(with-tramp-progress-reporter
|
||||
(tramp-dissect-file-name (if (file-remote-p filename) filename newname))
|
||||
(tramp-dissect-file-name
|
||||
(if (tramp-tramp-file-p filename) filename newname))
|
||||
0 (format "Renaming %s to %s" filename newname)
|
||||
|
||||
(if (and (not (file-exists-p newname))
|
||||
|
|
@ -1260,67 +1273,85 @@ target of the symlink differ."
|
|||
(tramp-compat-delete-directory filename 'recursive)
|
||||
(delete-file filename)))))
|
||||
|
||||
(defun tramp-smb-action-set-acl (proc vec)
|
||||
"Read ACL data from connection buffer."
|
||||
(when (not (memq (process-status proc) '(run open)))
|
||||
;; Accept pending output.
|
||||
(while (tramp-accept-process-output proc 0.1))
|
||||
(with-current-buffer (tramp-get-connection-buffer vec)
|
||||
(tramp-message vec 10 "\n%s" (buffer-string))
|
||||
(throw 'tramp-action 'ok))))
|
||||
|
||||
(defun tramp-smb-handle-set-file-acl (filename acl-string)
|
||||
"Like `set-file-acl' for Tramp files."
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
|
||||
(ignore-errors
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
|
||||
(setq tramp-current-method (tramp-file-name-method v)
|
||||
tramp-current-user (tramp-file-name-user v)
|
||||
tramp-current-host (tramp-file-name-real-host v))
|
||||
(tramp-set-file-property v localname "file-acl" 'undef)
|
||||
|
||||
(setq tramp-current-method (tramp-file-name-method v)
|
||||
tramp-current-user (tramp-file-name-user v)
|
||||
tramp-current-host (tramp-file-name-real-host v))
|
||||
(tramp-set-file-property v localname "file-acl" 'undef)
|
||||
(let* ((real-user (tramp-file-name-real-user v))
|
||||
(real-host (tramp-file-name-real-host v))
|
||||
(domain (tramp-file-name-domain v))
|
||||
(port (tramp-file-name-port v))
|
||||
(share (tramp-smb-get-share v))
|
||||
(localname (tramp-compat-replace-regexp-in-string
|
||||
"\\\\" "/" (tramp-smb-get-localname v)))
|
||||
(args (list (concat "//" real-host "/" share) "-E" "-S"
|
||||
(tramp-compat-replace-regexp-in-string
|
||||
"\n" "," acl-string))))
|
||||
|
||||
(let* ((real-user (tramp-file-name-real-user v))
|
||||
(real-host (tramp-file-name-real-host v))
|
||||
(domain (tramp-file-name-domain v))
|
||||
(port (tramp-file-name-port v))
|
||||
(share (tramp-smb-get-share v))
|
||||
(localname (tramp-compat-replace-regexp-in-string
|
||||
"\\\\" "/" (tramp-smb-get-localname v)))
|
||||
(args (list (concat "//" real-host "/" share) "-E" "-S"
|
||||
(tramp-compat-replace-regexp-in-string
|
||||
"\n" "," acl-string))))
|
||||
(if (not (zerop (length real-user)))
|
||||
(setq args (append args (list "-U" real-user)))
|
||||
(setq args (append args (list "-N"))))
|
||||
|
||||
(if (not (zerop (length real-user)))
|
||||
(setq args (append args (list "-U" real-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 (shell-quote-argument localname)
|
||||
"&&" "echo" "tramp_exit_status" "0"
|
||||
"||" "echo" "tramp_exit_status" "1")))
|
||||
|
||||
(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 (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 processes. By this, password can
|
||||
;; be handled.
|
||||
(let ((p (apply
|
||||
'start-process-shell-command
|
||||
(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)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-set-acl)
|
||||
(goto-char (point-max))
|
||||
(unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
|
||||
(tramp-error
|
||||
v 'file-error
|
||||
"Couldn't find exit status of `%s'" tramp-smb-acl-program))
|
||||
(skip-chars-forward "^ ")
|
||||
(when (zerop (read (current-buffer)))
|
||||
;; Success.
|
||||
(tramp-set-file-property v localname "file-acl" acl-string)
|
||||
t)))
|
||||
|
||||
(tramp-message
|
||||
v 6 "%s" (mapconcat 'identity (process-command p) " "))
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-with-acl)
|
||||
(tramp-message v 6 "\n%s" (buffer-string))
|
||||
;; Success.
|
||||
(tramp-set-file-property v localname "file-acl" acl-string)
|
||||
t))
|
||||
|
||||
;; 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-set-file-modes (filename mode)
|
||||
"Like `set-file-modes' for Tramp files."
|
||||
|
|
@ -1819,6 +1850,7 @@ If ARGUMENT is non-nil, use it as argument for
|
|||
|
||||
(tramp-message
|
||||
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
|
||||
(tramp-set-connection-property p "vector" vec)
|
||||
(tramp-compat-set-process-query-on-exit-flag p nil)
|
||||
|
||||
;; Set variables for computing the prompt for reading password.
|
||||
|
|
@ -1936,10 +1968,6 @@ Returns nil if an error message has appeared."
|
|||
(defun tramp-smb-call-winexe (vec)
|
||||
"Apply a remote command, if possible, using `tramp-smb-winexe-program'."
|
||||
|
||||
;; We call `tramp-get-buffer' in order to get a debug buffer for
|
||||
;; messages.
|
||||
(tramp-get-buffer vec)
|
||||
|
||||
;; Check for program.
|
||||
(unless (executable-find tramp-smb-winexe-program)
|
||||
(tramp-error
|
||||
|
|
|
|||
|
|
@ -1433,67 +1433,65 @@ The outline level is equal to the verbosity of the Tramp message."
|
|||
"Append message to debug buffer.
|
||||
Message is formatted with FMT-STRING as control string and the remaining
|
||||
ARGUMENTS to actually emit the message (if applicable)."
|
||||
(when (get-buffer (tramp-buffer-name vec))
|
||||
(with-current-buffer (tramp-get-debug-buffer vec)
|
||||
(goto-char (point-max))
|
||||
;; Headline.
|
||||
(when (bobp)
|
||||
(insert
|
||||
(format
|
||||
";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-"
|
||||
(if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU "))
|
||||
emacs-version tramp-version)))
|
||||
(unless (bolp)
|
||||
(insert "\n"))
|
||||
;; Timestamp.
|
||||
(let ((now (current-time)))
|
||||
(insert (format-time-string "%T." now))
|
||||
(insert (format "%06d " (nth 2 now))))
|
||||
;; Calling Tramp function. We suppress compat and trace
|
||||
;; functions from being displayed.
|
||||
(let ((btn 1) btf fn)
|
||||
(while (not fn)
|
||||
(setq btf (nth 1 (backtrace-frame btn)))
|
||||
(if (not btf)
|
||||
(setq fn "")
|
||||
(when (symbolp btf)
|
||||
(setq fn (symbol-name btf))
|
||||
(unless
|
||||
(and
|
||||
(string-match "^tramp" fn)
|
||||
(not
|
||||
(string-match
|
||||
(concat
|
||||
"^"
|
||||
(regexp-opt
|
||||
'("tramp-backtrace"
|
||||
"tramp-compat-condition-case-unless-debug"
|
||||
"tramp-compat-funcall"
|
||||
"tramp-compat-with-temp-message"
|
||||
"tramp-condition-case-unless-debug"
|
||||
"tramp-debug-message"
|
||||
"tramp-error"
|
||||
"tramp-error-with-buffer"
|
||||
"tramp-message"
|
||||
"tramp-user-error")
|
||||
t)
|
||||
"$")
|
||||
fn)))
|
||||
(setq fn nil)))
|
||||
(setq btn (1+ btn))))
|
||||
;; The following code inserts filename and line number.
|
||||
;; Should be inactive by default, because it is time
|
||||
;; consuming.
|
||||
; (let ((ffn (find-function-noselect (intern fn))))
|
||||
; (insert
|
||||
; (format
|
||||
; "%s:%d: "
|
||||
; (file-name-nondirectory (buffer-file-name (car ffn)))
|
||||
; (with-current-buffer (car ffn)
|
||||
; (1+ (count-lines (point-min) (cdr ffn)))))))
|
||||
(insert (format "%s " fn)))
|
||||
;; The message.
|
||||
(insert (apply 'format fmt-string arguments)))))
|
||||
(with-current-buffer (tramp-get-debug-buffer vec)
|
||||
(goto-char (point-max))
|
||||
;; Headline.
|
||||
(when (bobp)
|
||||
(insert
|
||||
(format
|
||||
";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-"
|
||||
(if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU "))
|
||||
emacs-version tramp-version)))
|
||||
(unless (bolp)
|
||||
(insert "\n"))
|
||||
;; Timestamp.
|
||||
(let ((now (current-time)))
|
||||
(insert (format-time-string "%T." now))
|
||||
(insert (format "%06d " (nth 2 now))))
|
||||
;; Calling Tramp function. We suppress compat and trace functions
|
||||
;; from being displayed.
|
||||
(let ((btn 1) btf fn)
|
||||
(while (not fn)
|
||||
(setq btf (nth 1 (backtrace-frame btn)))
|
||||
(if (not btf)
|
||||
(setq fn "")
|
||||
(when (symbolp btf)
|
||||
(setq fn (symbol-name btf))
|
||||
(unless
|
||||
(and
|
||||
(string-match "^tramp" fn)
|
||||
(not
|
||||
(string-match
|
||||
(concat
|
||||
"^"
|
||||
(regexp-opt
|
||||
'("tramp-backtrace"
|
||||
"tramp-compat-condition-case-unless-debug"
|
||||
"tramp-compat-funcall"
|
||||
"tramp-compat-with-temp-message"
|
||||
"tramp-condition-case-unless-debug"
|
||||
"tramp-debug-message"
|
||||
"tramp-error"
|
||||
"tramp-error-with-buffer"
|
||||
"tramp-message"
|
||||
"tramp-user-error")
|
||||
t)
|
||||
"$")
|
||||
fn)))
|
||||
(setq fn nil)))
|
||||
(setq btn (1+ btn))))
|
||||
;; The following code inserts filename and line number. Should
|
||||
;; be inactive by default, because it is time consuming.
|
||||
; (let ((ffn (find-function-noselect (intern fn))))
|
||||
; (insert
|
||||
; (format
|
||||
; "%s:%d: "
|
||||
; (file-name-nondirectory (buffer-file-name (car ffn)))
|
||||
; (with-current-buffer (car ffn)
|
||||
; (1+ (count-lines (point-min) (cdr ffn)))))))
|
||||
(insert (format "%s " fn)))
|
||||
;; The message.
|
||||
(insert (apply 'format fmt-string arguments))))
|
||||
|
||||
(defvar tramp-message-show-message t
|
||||
"Show Tramp message in the minibuffer.
|
||||
|
|
@ -1530,13 +1528,13 @@ applicable)."
|
|||
arguments))
|
||||
;; Log only when there is a minimum level.
|
||||
(when (>= tramp-verbose 4)
|
||||
(when (and vec-or-proc
|
||||
(processp vec-or-proc)
|
||||
(buffer-name (process-buffer vec-or-proc)))
|
||||
(with-current-buffer (process-buffer vec-or-proc)
|
||||
;; Translate proc to vec.
|
||||
(setq vec-or-proc (tramp-dissect-file-name default-directory))))
|
||||
(when (and vec-or-proc (vectorp vec-or-proc))
|
||||
;; Translate proc to vec.
|
||||
(when (processp vec-or-proc)
|
||||
(let ((tramp-verbose 0))
|
||||
(setq vec-or-proc
|
||||
(tramp-get-connection-property vec-or-proc "vector" nil))))
|
||||
;; Do it.
|
||||
(when (vectorp vec-or-proc)
|
||||
(apply 'tramp-debug-message
|
||||
vec-or-proc
|
||||
(concat (format "(%d) # " level) fmt-string)
|
||||
|
|
@ -1548,7 +1546,7 @@ If VEC-OR-PROC is nil, the buffer *debug tramp* is used. This
|
|||
function is meant for debugging purposes."
|
||||
(if vec-or-proc
|
||||
(tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace)))
|
||||
(if (<= 10 tramp-verbose)
|
||||
(if (>= tramp-verbose 10)
|
||||
(with-output-to-temp-buffer "*debug tramp*" (backtrace)))))
|
||||
|
||||
(defsubst tramp-error (vec-or-proc signal fmt-string &rest arguments)
|
||||
|
|
@ -1821,7 +1819,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
|
|||
;; We do not want to send any remote command.
|
||||
(non-essential t))
|
||||
(when
|
||||
(file-remote-p
|
||||
(tramp-tramp-file-p
|
||||
(tramp-compat-funcall
|
||||
'buffer-substring-no-properties end (point-max)))
|
||||
(save-excursion
|
||||
|
|
@ -2356,7 +2354,8 @@ not in completion mode."
|
|||
(and (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(or (not (tramp-completion-mode-p))
|
||||
(let ((p (tramp-get-connection-process v)))
|
||||
(let* ((tramp-verbose 0)
|
||||
(p (tramp-get-connection-process v)))
|
||||
(and p (processp p) (memq (process-status p) '(run open))))))))
|
||||
|
||||
;; Method, host name and user name completion.
|
||||
|
|
@ -2934,7 +2933,8 @@ User is always nil."
|
|||
|
||||
(defun tramp-handle-file-remote-p (filename &optional identification connected)
|
||||
"Like `file-remote-p' for Tramp files."
|
||||
(let ((tramp-verbose 3))
|
||||
;; We do not want traces in the debug buffer.
|
||||
(let ((tramp-verbose (min tramp-verbose 3)))
|
||||
(when (tramp-tramp-file-p filename)
|
||||
(let* ((v (tramp-dissect-file-name filename))
|
||||
(p (tramp-get-connection-process v))
|
||||
|
|
@ -3663,8 +3663,8 @@ Example:
|
|||
would yield `t'. On the other hand, the following check results in nil:
|
||||
|
||||
(tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")"
|
||||
(and (stringp (file-remote-p file1))
|
||||
(stringp (file-remote-p file2))
|
||||
(and (tramp-tramp-file-p file1)
|
||||
(tramp-tramp-file-p file2)
|
||||
(string-equal (file-remote-p file1) (file-remote-p file2))))
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
|
@ -4198,7 +4198,7 @@ Only works for Bourne-like shells."
|
|||
(defun tramp-eshell-directory-change ()
|
||||
"Set `eshell-path-env' to $PATH of the host related to `default-directory'."
|
||||
(setq eshell-path-env
|
||||
(if (file-remote-p default-directory)
|
||||
(if (tramp-tramp-file-p default-directory)
|
||||
(with-parsed-tramp-file-name default-directory nil
|
||||
(mapconcat
|
||||
'identity
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue