From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Hansen Newsgroups: gmane.emacs.devel Subject: Bugfix and improved error handling Date: Tue, 21 Nov 2006 20:22:03 +0100 Message-ID: <456351DB.8010805@soem.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030506030109020901060208" X-Trace: sea.gmane.org 1164136965 320 80.91.229.2 (21 Nov 2006 19:22:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 21 Nov 2006 19:22:45 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 21 20:22:41 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GmbCF-0003gn-Ak for ged-emacs-devel@m.gmane.org; Tue, 21 Nov 2006 20:22:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmbCE-00069R-Pe for ged-emacs-devel@m.gmane.org; Tue, 21 Nov 2006 14:22:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GmbC3-00069M-Uf for emacs-devel@gnu.org; Tue, 21 Nov 2006 14:22:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GmbC3-00069A-01 for emacs-devel@gnu.org; Tue, 21 Nov 2006 14:22:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmbC2-000697-TL for emacs-devel@gnu.org; Tue, 21 Nov 2006 14:22:06 -0500 Original-Received: from [195.184.96.12] (helo=smtp.webpartner.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GmbC2-0003PK-HB for emacs-devel@gnu.org; Tue, 21 Nov 2006 14:22:07 -0500 Original-Received: from [10.17.0.175] (unknown [85.235.249.244]) by smtp.webpartner.dk (Postfix) with ESMTP id 31381938BF9; Tue, 21 Nov 2006 20:22:01 +0100 (CET) User-Agent: Icedove 1.5.0.7 (X11/20061013) Original-To: Michael Albinus , emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:62603 Archived-At: This is a multi-part message in MIME format. --------------030506030109020901060208 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit The attached patch has improved error handling for out-of-band copying and some bug fixes. The changes are: 1. Give error message "permission denied"/"not a regular file"/"no such file or directory" rather than the misleading "login failed" when appropriate. 2. Also kill the copy program buffer when an error occurs (bugfix). 3. Use pscp as default method under windows. Objections? --------------030506030109020901060208 Content-Type: text/x-patch; name="tramp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tramp.diff" *** /home/lh/cvsroot/emacs/lisp/net/tramp.el 2006-11-18 19:48:32.000000000 +0100 --- tramp.el 2006-11-21 20:05:28.000000000 +0100 *************** *** 673,680 **** (defcustom tramp-default-method (if (and (fboundp 'executable-find) ! (executable-find "plink")) ! "plink" "scp") "*Default method to use for transferring files. See `tramp-methods' for possibilities. --- 673,680 ---- (defcustom tramp-default-method (if (and (fboundp 'executable-find) ! (executable-find "pscp")) ! "pscp" "scp") "*Default method to use for transferring files. See `tramp-methods' for possibilities. *************** *** 1327,1351 **** Whenever a pattern matches, the corresponding action is performed. Each item looks like (PATTERN ACTION). ! The PATTERN should be a symbol, a variable. The value of this ! variable gives the regular expression to search for. Note that the ! regexp must match at the end of the buffer, \"\\'\" is implicitly ! appended to it. ! The ACTION should also be a symbol, but a function. When the ! corresponding PATTERN matches, the ACTION function is called." :group 'tramp ! :type '(repeat (list variable function))) (defcustom tramp-actions-copy-out-of-band '((tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (tramp-process-alive-regexp tramp-action-out-of-band)) "List of pattern/action pairs. This list is used for copying/renaming with out-of-band methods. See `tramp-actions-before-shell' for more info." :group 'tramp ! :type '(repeat (list variable function))) (defcustom tramp-multi-actions '((tramp-password-prompt-regexp tramp-multi-action-password) --- 1327,1354 ---- Whenever a pattern matches, the corresponding action is performed. Each item looks like (PATTERN ACTION). ! The PATTERN should be a form. This form must evaluate to a ! regular expression to search for. Note that the regexp must match ! at the end of the buffer except for trailing blanks. When PATTERN ! is evaluated, the symbols `method', `user' and `host' are bound. ! The ACTION should be a symbol, a function. When the corresponding ! PATTERN matches, the ACTION function is called." :group 'tramp ! :type '(repeat (list form function))) (defcustom tramp-actions-copy-out-of-band '((tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) + ("\\(.+: Permission denied\\)" tramp-action-copy-failed) + ("\\(.+: \\(not a regular file\\|is a directory\\)\\)" tramp-action-copy-failed) + ("\\(.+: No such file or directory\\)" tramp-action-copy-failed) (tramp-process-alive-regexp tramp-action-out-of-band)) "List of pattern/action pairs. This list is used for copying/renaming with out-of-band methods. See `tramp-actions-before-shell' for more info." :group 'tramp ! :type '(repeat (list form function))) (defcustom tramp-multi-actions '((tramp-password-prompt-regexp tramp-multi-action-password) *************** *** 1358,1364 **** This list is used for each hop in multi-hop connections. See `tramp-actions-before-shell' for more info." :group 'tramp ! :type '(repeat (list variable function))) (defcustom tramp-initial-commands '("unset HISTORY" --- 1361,1367 ---- This list is used for each hop in multi-hop connections. See `tramp-actions-before-shell' for more info." :group 'tramp ! :type '(repeat (list form function))) (defcustom tramp-initial-commands '("unset HISTORY" *************** *** 3174,3185 **** (message "Transferring %s to %s..." filename newname) ;; Use rcp-like program for file transfer. ! (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf ! copy-program copy-args))) ! (tramp-set-process-query-on-exit-flag p nil) ! (tramp-process-actions p multi-method method user host ! tramp-actions-copy-out-of-band)) ! (kill-buffer trampbuf) (message "Transferring %s to %s...done" filename newname) ;; Set the mode. --- 3177,3189 ---- (message "Transferring %s to %s..." filename newname) ;; Use rcp-like program for file transfer. ! (unwind-protect ! (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf ! copy-program copy-args))) ! (tramp-set-process-query-on-exit-flag p nil) ! (tramp-process-actions p multi-method method user host ! tramp-actions-copy-out-of-band)) ! (kill-buffer trampbuf)) (message "Transferring %s to %s...done" filename newname) ;; Set the mode. *************** *** 5353,5358 **** --- 5357,5367 ---- (kill-process p) (throw 'tramp-action 'permission-denied)) + (defun tramp-action-copy-failed (p multi-method method user host) + "Signal copy failed." + (kill-process p) + (error "%s" (match-string 1))) + (defun tramp-action-yesno (p multi-method method user host) "Ask the user for confirmation using `yes-or-no-p'. Send \"yes\" to remote process on confirmation, abort otherwise. *************** *** 5409,5417 **** (tramp-message 10 "'set mode' error ignored.") (tramp-message 9 "Process has finished.") (throw 'tramp-action 'ok)) - (goto-char (point-min)) - (when (re-search-forward "^.cp.?: \\(.+: Permission denied.?\\)$" nil t) - (error "Remote host: %s" (match-string 1))) (tramp-message 9 "Process has died.") (throw 'tramp-action 'process-died))) (t nil))) --- 5418,5423 ---- *************** *** 5466,5476 **** (while todo (goto-char (point-min)) (setq item (pop todo)) ! (setq pattern (symbol-value (nth 0 item))) (setq action (nth 1 item)) (tramp-message 10 "Looking for regexp \"%s\" from remote shell" pattern) ! (when (re-search-forward (concat pattern "\\'") nil t) (setq found (funcall action p multi-method method user host))))) found))) --- 5472,5482 ---- (while todo (goto-char (point-min)) (setq item (pop todo)) ! (setq pattern (eval (nth 0 item))) (setq action (nth 1 item)) (tramp-message 10 "Looking for regexp \"%s\" from remote shell" pattern) ! (when (re-search-forward (concat pattern "[ \t\n]*\\'") nil t) (setq found (funcall action p multi-method method user host))))) found))) *************** *** 5503,5509 **** (while todo (goto-char (point-min)) (setq item (pop todo)) ! (setq pattern (symbol-value (nth 0 item))) (setq action (nth 1 item)) (tramp-message 10 "Looking for regexp \"%s\" from remote shell" pattern) --- 5509,5515 ---- (while todo (goto-char (point-min)) (setq item (pop todo)) ! (setq pattern (eval (nth 0 item))) (setq action (nth 1 item)) (tramp-message 10 "Looking for regexp \"%s\" from remote shell" pattern) --------------030506030109020901060208 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------030506030109020901060208--