[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114188: * net/tramp.el (tramp-cleanup): Remove. Fun
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] trunk r114188: * net/tramp.el (tramp-cleanup): Remove. Functionality added to |
Date: |
Tue, 10 Sep 2013 07:46:32 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114188
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Tue 2013-09-10 09:45:33 +0200
message:
* net/tramp.el (tramp-cleanup): Remove. Functionality added to
`tramp-cleanup-connection'.
* net/tramp-cmds.el (tramp-cleanup-connection): Add optional
parameters KEEP-DEBUG and KEEP-PASSWORD.
* net/tramp.el (tramp-file-name-handler):
* net/tramp-adb.el (tramp-adb-maybe-open-connection):
* net/tramp-sh.el (tramp-open-connection-setup-interactive-shell)
(tramp-maybe-open-connection):
* net/tramp-smb.el (tramp-smb-maybe-open-connection): Use
`tramp-cleanup-connection'.
* net/tramp-sh.el (tramp-maybe-open-connection): Catch
'uname-changed inside the progress reporter.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/net/tramp-adb.el trampadb.el-20121204164216-03wyr5miam215d7f-1
lisp/net/tramp-cmds.el
trampcmds.el-20091113204419-o5vbwnq5f7feedwu-7524
lisp/net/tramp-sh.el trampsh.el-20100913133439-a1faifh29eqoi4nh-1
lisp/net/tramp-smb.el
trampsmb.el-20091113204419-o5vbwnq5f7feedwu-2515
lisp/net/tramp.el tramp.el-20091113204419-o5vbwnq5f7feedwu-2427
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-09-10 07:21:19 +0000
+++ b/lisp/ChangeLog 2013-09-10 07:45:33 +0000
@@ -1,3 +1,21 @@
+2013-09-10 Michael Albinus <address@hidden>
+
+ * net/tramp.el (tramp-cleanup): Remove. Functionality added to
+ `tramp-cleanup-connection'.
+
+ * net/tramp-cmds.el (tramp-cleanup-connection): Add optional
+ parameters KEEP-DEBUG and KEEP-PASSWORD.
+
+ * net/tramp.el (tramp-file-name-handler):
+ * net/tramp-adb.el (tramp-adb-maybe-open-connection):
+ * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell)
+ (tramp-maybe-open-connection):
+ * net/tramp-smb.el (tramp-smb-maybe-open-connection): Use
+ `tramp-cleanup-connection'.
+
+ * net/tramp-sh.el (tramp-maybe-open-connection): Catch
+ 'uname-changed inside the progress reporter.
+
2013-09-10 Glenn Morris <address@hidden>
* simple.el (read-minibuffer): Unbreak it. (Bug#15318)
=== modified file 'lisp/net/tramp-adb.el'
--- a/lisp/net/tramp-adb.el 2013-09-08 15:04:10 +0000
+++ b/lisp/net/tramp-adb.el 2013-09-10 07:45:33 +0000
@@ -1153,11 +1153,11 @@
(read (current-buffer))))))
(when (and (stringp old-getprop)
(not (string-equal old-getprop new-getprop)))
- (tramp-cleanup vec)
(tramp-message
vec 3
"Connection reset, because remote host changed from `%s' to
`%s'"
old-getprop new-getprop)
+ (tramp-cleanup-connection vec t)
(tramp-adb-maybe-open-connection vec)))
;; Change user if indicated.
=== modified file 'lisp/net/tramp-cmds.el'
--- a/lisp/net/tramp-cmds.el 2013-09-08 15:04:10 +0000
+++ b/lisp/net/tramp-cmds.el 2013-09-10 07:45:33 +0000
@@ -55,9 +55,11 @@
(buffer-list))))
;;;###tramp-autoload
-(defun tramp-cleanup-connection (vec)
+(defun tramp-cleanup-connection (vec &optional keep-debug keep-password)
"Flush all connection related objects.
-This includes password cache, file cache, connection cache, buffers.
+This includes password cache, file cache, connection cache,
+buffers. KEEP-DEBUG non-nil preserves the debug buffer.
+KEEP-PASSWORD non-nil preserves the password cache.
When called interactively, a Tramp connection has to be selected."
(interactive
;; When interactive, select the Tramp remote identification.
@@ -80,14 +82,15 @@
"Enter Tramp connection: " connections nil t
(try-completion "" connections)))
(when (and name (file-remote-p name))
- (with-parsed-tramp-file-name name nil v))))))
+ (with-parsed-tramp-file-name name nil v))))
+ nil nil))
(if (not vec)
;; Nothing to do.
(message "No Tramp connection found.")
;; Flush password cache.
- (tramp-clear-passwd vec)
+ (unless keep-password (tramp-clear-passwd vec))
;; Flush file cache.
(tramp-flush-directory-property vec "")
@@ -101,7 +104,8 @@
;; Remove buffers.
(dolist
(buf (list (get-buffer (tramp-buffer-name vec))
- (get-buffer (tramp-debug-buffer-name vec))
+ (unless keep-debug
+ (get-buffer (tramp-debug-buffer-name vec)))
(tramp-get-connection-property vec "process-buffer" nil)))
(when (bufferp buf) (kill-buffer buf)))))
=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el 2013-09-08 15:04:10 +0000
+++ b/lisp/net/tramp-sh.el 2013-09-10 07:45:33 +0000
@@ -3805,11 +3805,12 @@
vec "uname"
(tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
(when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
- (tramp-cleanup vec)
(tramp-message
vec 3
"Connection reset, because remote host changed from `%s' to `%s'"
old-uname new-uname)
+ ;; We want to keep the password.
+ (tramp-cleanup-connection vec t t)
(throw 'uname-changed (tramp-maybe-open-connection vec))))
;; Check whether the remote host suffers from buggy
@@ -4287,68 +4288,68 @@
connection if a previous connection has died for some reason."
(tramp-check-proper-host vec)
- (catch 'uname-changed
- (let ((p (tramp-get-connection-process vec))
- (process-name (tramp-get-connection-property vec "process-name" nil))
- (process-environment (copy-sequence process-environment))
- (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
-
- ;; If Tramp opens the same connection within a short time frame,
- ;; there is a problem. We shall signal this.
- (unless (or (and p (processp p) (memq (process-status p) '(run open)))
- (not (equal (butlast (append vec nil) 2)
- (car tramp-current-connection)))
- (> (tramp-time-diff
- (current-time) (cdr tramp-current-connection))
- (or tramp-connection-min-time-diff 0)))
- (throw 'suppress 'suppress))
-
- ;; If too much time has passed since last command was sent, look
- ;; whether process is still alive. If it isn't, kill it. When
- ;; using ssh, it can sometimes happen that the remote end has
- ;; hung up but the local ssh client doesn't recognize this until
- ;; it tries to send some data to the remote end. So that's why
- ;; we try to send a command from time to time, then look again
- ;; whether the process is really alive.
- (condition-case nil
- (when (and (> (tramp-time-diff
- (current-time)
- (tramp-get-connection-property
- p "last-cmd-time" '(0 0 0)))
- 60)
- p (processp p) (memq (process-status p) '(run open)))
- (tramp-send-command vec "echo are you awake" t t)
- (unless (and (memq (process-status p) '(run open))
- (tramp-wait-for-output p 10))
- ;; The error will be caught locally.
- (tramp-error vec 'file-error "Awake did fail")))
- (file-error
- (tramp-cleanup vec)
- (setq p nil)))
-
- ;; New connection must be opened.
- (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))
-
- (with-tramp-progress-reporter
- vec 3
- (if (zerop (length (tramp-file-name-user vec)))
- (format "Opening connection for %s using %s"
- (tramp-file-name-host vec)
- (tramp-file-name-method vec))
- (format "Opening connection for address@hidden using %s"
- (tramp-file-name-user vec)
+ (let ((p (tramp-get-connection-process vec))
+ (process-name (tramp-get-connection-property vec "process-name" nil))
+ (process-environment (copy-sequence process-environment))
+ (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
+
+ ;; If Tramp opens the same connection within a short time frame,
+ ;; there is a problem. We shall signal this.
+ (unless (or (and p (processp p) (memq (process-status p) '(run open)))
+ (not (equal (butlast (append vec nil) 2)
+ (car tramp-current-connection)))
+ (> (tramp-time-diff
+ (current-time) (cdr tramp-current-connection))
+ (or tramp-connection-min-time-diff 0)))
+ (throw 'suppress 'suppress))
+
+ ;; If too much time has passed since last command was sent, look
+ ;; whether process is still alive. If it isn't, kill it. When
+ ;; using ssh, it can sometimes happen that the remote end has hung
+ ;; up but the local ssh client doesn't recognize this until it
+ ;; tries to send some data to the remote end. So that's why we
+ ;; try to send a command from time to time, then look again
+ ;; whether the process is really alive.
+ (condition-case nil
+ (when (and (> (tramp-time-diff
+ (current-time)
+ (tramp-get-connection-property
+ p "last-cmd-time" '(0 0 0)))
+ 60)
+ p (processp p) (memq (process-status p) '(run open)))
+ (tramp-send-command vec "echo are you awake" t t)
+ (unless (and (memq (process-status p) '(run open))
+ (tramp-wait-for-output p 10))
+ ;; The error will be caught locally.
+ (tramp-error vec 'file-error "Awake did fail")))
+ (file-error
+ (tramp-cleanup-connection vec t)
+ (setq p nil)))
+
+ ;; New connection must be opened.
+ (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))
+
+ (with-tramp-progress-reporter
+ vec 3
+ (if (zerop (length (tramp-file-name-user vec)))
+ (format "Opening connection for %s using %s"
(tramp-file-name-host vec)
- (tramp-file-name-method vec)))
+ (tramp-file-name-method vec))
+ (format "Opening connection for address@hidden using %s"
+ (tramp-file-name-user vec)
+ (tramp-file-name-host vec)
+ (tramp-file-name-method vec)))
+ (catch 'uname-changed
;; Start new process.
(when (and p (processp p))
(delete-process p))
@@ -4503,13 +4504,13 @@
target-alist (cdr target-alist)))
;; Make initial shell settings.
- (tramp-open-connection-setup-interactive-shell p vec))))
+ (tramp-open-connection-setup-interactive-shell p vec)))))
- ;; When the user did interrupt, we must cleanup.
- (quit
- (tramp-cleanup vec)
- ;; Propagate the quit signal.
- (signal (car err) (cdr err)))))))
+ ;; When the user did interrupt, we must cleanup.
+ (quit
+ (tramp-cleanup-connection vec t)
+ ;; Propagate the quit signal.
+ (signal (car err) (cdr err))))))
(defun tramp-send-command (vec command &optional neveropen nooutput)
"Send the COMMAND to connection VEC.
=== modified file 'lisp/net/tramp-smb.el'
--- a/lisp/net/tramp-smb.el 2013-09-08 15:04:10 +0000
+++ b/lisp/net/tramp-smb.el 2013-09-10 07:45:33 +0000
@@ -1726,8 +1726,10 @@
(search-forward-regexp
tramp-smb-wrong-passwd-regexp nil t))
;; Disable `auth-source' and `password-cache'.
+ (tramp-message
+ vec 3 "Retry connection with new password")
(let (auth-sources)
- (tramp-cleanup vec)
+ (tramp-cleanup-connection vec t)
(tramp-smb-maybe-open-connection vec argument))
;; Propagate the error.
(signal (car err) (cdr err)))))))))))))
=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2013-09-08 15:04:10 +0000
+++ b/lisp/net/tramp.el 2013-09-10 07:45:33 +0000
@@ -1712,19 +1712,6 @@
(replace-match "/" nil t name)
name)))
-(defun tramp-cleanup (vec)
- "Cleanup connection VEC, but keep the debug buffer."
- (with-current-buffer (tramp-get-debug-buffer vec)
- ;; Keep the debug buffer.
- (rename-buffer
- (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
- (tramp-cleanup-connection vec)
- (if (= (point-min) (point-max))
- (kill-buffer nil)
- (rename-buffer (tramp-debug-buffer-name vec) 'unique))
- ;; We call `tramp-get-buffer' in order to keep the debug buffer.
- (tramp-get-buffer vec)))
-
;;; Config Manipulation Functions:
;;;###tramp-autoload
@@ -2147,7 +2134,7 @@
(tramp-message
v 1 "Suppress received in operation %s"
(append (list operation) args))
- (tramp-cleanup v)
+ (tramp-cleanup-connection v t)
(tramp-run-real-handler operation args)))
(t result)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114188: * net/tramp.el (tramp-cleanup): Remove. Functionality added to,
Michael Albinus <=