diff options
| author | Michael Albinus | 2010-12-08 21:07:25 +0100 |
|---|---|---|
| committer | Michael Albinus | 2010-12-08 21:07:25 +0100 |
| commit | 32802ee17de9429e07b546aa4e2febe7f0f7072a (patch) | |
| tree | 8e6b509e5a8267664b5e758f7de2dfa9b1f8c5b7 | |
| parent | da9123a8350059d10c2d73586a332d195894ae48 (diff) | |
| download | emacs-32802ee17de9429e07b546aa4e2febe7f0f7072a.tar.gz emacs-32802ee17de9429e07b546aa4e2febe7f0f7072a.zip | |
* net/tramp.el (tramp-handle-start-file-process): Protect
buffer-modified value. (Bug#7557)
(tramp-action-password): Delete region, do not narrow.
(tramp-process-actions): Do not widen.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 119 |
2 files changed, 69 insertions, 57 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a52a158f243..814c5ef89fa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-12-08 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-handle-start-file-process): Protect | ||
| 4 | buffer-modified value. (Bug#7557) | ||
| 5 | (tramp-action-password): Delete region, do not narrow. | ||
| 6 | (tramp-process-actions): Do not widen. | ||
| 7 | |||
| 1 | 2010-12-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de> | 8 | 2010-12-08 Jan Moringen <jmoringe@techfak.uni-bielefeld.de> |
| 2 | 9 | ||
| 3 | * log-edit.el (log-edit-changelog-entries): | 10 | * log-edit.el (log-edit-changelog-entries): |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a9733fc6a0f..0b7bae67082 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4522,60 +4522,65 @@ beginning of local filename are not substituted." | |||
| 4522 | (defun tramp-handle-start-file-process (name buffer program &rest args) | 4522 | (defun tramp-handle-start-file-process (name buffer program &rest args) |
| 4523 | "Like `start-file-process' for Tramp files." | 4523 | "Like `start-file-process' for Tramp files." |
| 4524 | (with-parsed-tramp-file-name default-directory nil | 4524 | (with-parsed-tramp-file-name default-directory nil |
| 4525 | (unwind-protect | 4525 | ;; When PROGRAM is nil, we just provide a tty. |
| 4526 | ;; When PROGRAM is nil, we just provide a tty. | 4526 | (let ((command |
| 4527 | (let ((command | 4527 | (when (stringp program) |
| 4528 | (when (stringp program) | 4528 | (format "cd %s; exec %s" |
| 4529 | (format "cd %s; exec %s" | 4529 | (tramp-shell-quote-argument localname) |
| 4530 | (tramp-shell-quote-argument localname) | 4530 | (mapconcat 'tramp-shell-quote-argument |
| 4531 | (mapconcat 'tramp-shell-quote-argument | 4531 | (cons program args) " ")))) |
| 4532 | (cons program args) " ")))) | 4532 | (tramp-process-connection-type |
| 4533 | (tramp-process-connection-type | 4533 | (or (null program) tramp-process-connection-type)) |
| 4534 | (or (null program) tramp-process-connection-type)) | 4534 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) |
| 4535 | (name1 name) | 4535 | (name1 name) |
| 4536 | (i 0)) | 4536 | (i 0)) |
| 4537 | (unless buffer | 4537 | (unwind-protect |
| 4538 | ;; BUFFER can be nil. We use a temporary buffer. | 4538 | (save-excursion |
| 4539 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) | 4539 | (save-restriction |
| 4540 | (while (get-process name1) | 4540 | (unless buffer |
| 4541 | ;; NAME must be unique as process name. | 4541 | ;; BUFFER can be nil. We use a temporary buffer. |
| 4542 | (setq i (1+ i) | 4542 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) |
| 4543 | name1 (format "%s<%d>" name i))) | 4543 | (while (get-process name1) |
| 4544 | (setq name name1) | 4544 | ;; NAME must be unique as process name. |
| 4545 | ;; Set the new process properties. | 4545 | (setq i (1+ i) |
| 4546 | (tramp-set-connection-property v "process-name" name) | 4546 | name1 (format "%s<%d>" name i))) |
| 4547 | (tramp-set-connection-property v "process-buffer" buffer) | 4547 | (setq name name1) |
| 4548 | ;; Activate narrowing in order to save BUFFER contents. | 4548 | ;; Set the new process properties. |
| 4549 | ;; Clear also the modification time; otherwise we might be | 4549 | (tramp-set-connection-property v "process-name" name) |
| 4550 | ;; interrupted by `verify-visited-file-modtime'. | 4550 | (tramp-set-connection-property v "process-buffer" buffer) |
| 4551 | (with-current-buffer (tramp-get-connection-buffer v) | 4551 | ;; Activate narrowing in order to save BUFFER contents. |
| 4552 | (clear-visited-file-modtime) | 4552 | ;; Clear also the modification time; otherwise we might |
| 4553 | (narrow-to-region (point-max) (point-max))) | 4553 | ;; be interrupted by `verify-visited-file-modtime'. |
| 4554 | (if command | 4554 | (with-current-buffer (tramp-get-connection-buffer v) |
| 4555 | ;; Send the command. | 4555 | (let ((buffer-undo-list t)) |
| 4556 | (tramp-send-command v command nil t) ; nooutput | 4556 | (clear-visited-file-modtime) |
| 4557 | ;; Check, whether a pty is associated. | 4557 | (narrow-to-region (point-max) (point-max)) |
| 4558 | (tramp-maybe-open-connection v) | 4558 | (if command |
| 4559 | (unless (process-get (tramp-get-connection-process v) 'remote-tty) | 4559 | ;; Send the command. |
| 4560 | (tramp-error | 4560 | (tramp-send-command v command nil t) ; nooutput |
| 4561 | v 'file-error "pty association is not supported for `%s'" name))) | 4561 | ;; Check, whether a pty is associated. |
| 4562 | (let ((p (tramp-get-connection-process v))) | 4562 | (tramp-maybe-open-connection v) |
| 4563 | ;; Set sentinel and query flag for this process. | 4563 | (unless (process-get |
| 4564 | (tramp-set-connection-property p "vector" v) | 4564 | (tramp-get-connection-process v) 'remote-tty) |
| 4565 | (set-process-sentinel p 'tramp-process-sentinel) | 4565 | (tramp-error |
| 4566 | (tramp-set-process-query-on-exit-flag p t) | 4566 | v 'file-error |
| 4567 | ;; Return process. | 4567 | "pty association is not supported for `%s'" name))))) |
| 4568 | p)) | 4568 | (let ((p (tramp-get-connection-process v))) |
| 4569 | ;; Save exit. | 4569 | ;; Set sentinel and query flag for this process. |
| 4570 | (with-current-buffer (tramp-get-connection-buffer v) | 4570 | (tramp-set-connection-property p "vector" v) |
| 4571 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 4571 | (set-process-sentinel p 'tramp-process-sentinel) |
| 4572 | (progn | 4572 | (tramp-set-process-query-on-exit-flag p t) |
| 4573 | (set-process-buffer (tramp-get-connection-process v) nil) | 4573 | ;; Return process. |
| 4574 | (kill-buffer (current-buffer))) | 4574 | p))) |
| 4575 | (widen) | 4575 | ;; Save exit. |
| 4576 | (goto-char (point-max)))) | 4576 | (with-current-buffer (tramp-get-connection-buffer v) |
| 4577 | (tramp-set-connection-property v "process-name" nil) | 4577 | (if (string-match tramp-temp-buffer-name (buffer-name)) |
| 4578 | (tramp-set-connection-property v "process-buffer" nil)))) | 4578 | (progn |
| 4579 | (set-process-buffer (tramp-get-connection-process v) nil) | ||
| 4580 | (kill-buffer (current-buffer))) | ||
| 4581 | (set-buffer-modified-p bmp))) | ||
| 4582 | (tramp-set-connection-property v "process-name" nil) | ||
| 4583 | (tramp-set-connection-property v "process-buffer" nil))))) | ||
| 4579 | 4584 | ||
| 4580 | (defun tramp-handle-process-file | 4585 | (defun tramp-handle-process-file |
| 4581 | (program &optional infile destination display &rest args) | 4586 | (program &optional infile destination display &rest args) |
| @@ -6707,9 +6712,10 @@ file exists and nonzero exit status otherwise." | |||
| 6707 | (with-current-buffer (process-buffer proc) | 6712 | (with-current-buffer (process-buffer proc) |
| 6708 | (tramp-check-for-regexp proc tramp-password-prompt-regexp) | 6713 | (tramp-check-for-regexp proc tramp-password-prompt-regexp) |
| 6709 | (tramp-message vec 3 "Sending %s" (match-string 1)) | 6714 | (tramp-message vec 3 "Sending %s" (match-string 1)) |
| 6715 | (tramp-message vec 6 "\n%s" (buffer-string))) | ||
| 6710 | (tramp-enter-password proc) | 6716 | (tramp-enter-password proc) |
| 6711 | ;; Hide password prompt. | 6717 | ;; Remove password prompt, in order not to find it next iteration. |
| 6712 | (narrow-to-region (point-max) (point-max)))) | 6718 | (delete-region (point-min) (point-max))) |
| 6713 | 6719 | ||
| 6714 | (defun tramp-action-succeed (proc vec) | 6720 | (defun tramp-action-succeed (proc vec) |
| 6715 | "Signal success in finding shell prompt." | 6721 | "Signal success in finding shell prompt." |
| @@ -6820,7 +6826,6 @@ The terminal type can be configured with `tramp-terminal-type'." | |||
| 6820 | (tramp-process-one-action proc vec actions)) | 6826 | (tramp-process-one-action proc vec actions)) |
| 6821 | (tramp-process-one-action proc vec actions))))) | 6827 | (tramp-process-one-action proc vec actions))))) |
| 6822 | (with-current-buffer (tramp-get-connection-buffer vec) | 6828 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 6823 | (widen) | ||
| 6824 | (tramp-message vec 6 "\n%s" (buffer-string))) | 6829 | (tramp-message vec 6 "\n%s" (buffer-string))) |
| 6825 | (unless (eq exit 'ok) | 6830 | (unless (eq exit 'ok) |
| 6826 | (tramp-clear-passwd vec) | 6831 | (tramp-clear-passwd vec) |