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: Re: Bugfix and improved error handling Date: Fri, 24 Nov 2006 17:28:10 +0100 Message-ID: <45671D9A.3050209@soem.dk> References: <456351DB.8010805@soem.dk> <87k61lq1gm.fsf@gmx.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020309020205030700010002" X-Trace: sea.gmane.org 1164389181 22094 80.91.229.2 (24 Nov 2006 17:26:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2006 17:26:21 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 24 18:26:19 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 1GneoZ-00036c-Ex for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2006 18:26:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GneoY-0008Qy-Vn for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2006 12:26:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GneoK-0008QI-Cl for emacs-devel@gnu.org; Fri, 24 Nov 2006 12:26:00 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GneoI-0008PJ-GA for emacs-devel@gnu.org; Fri, 24 Nov 2006 12:26:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GneoI-0008PD-Df for emacs-devel@gnu.org; Fri, 24 Nov 2006 12:25:58 -0500 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GneoI-0002n5-4j for emacs-devel@gnu.org; Fri, 24 Nov 2006 12:25:58 -0500 Original-Received: from [195.184.96.12] (helo=smtp.webpartner.dk) by mx20.gnu.org with esmtp (Exim 4.52) id 1Gndvs-0004ym-3z for emacs-devel@gnu.org; Fri, 24 Nov 2006 11:29:44 -0500 Original-Received: from [10.17.0.30] (unknown [85.235.249.244]) by smtp.webpartner.dk (Postfix) with ESMTP id C80E4938D6B; Fri, 24 Nov 2006 17:28:09 +0100 (CET) User-Agent: Debian Thunderbird 1.0.2 (X11/20060926) X-Accept-Language: en-us, en Original-To: Michael Albinus In-Reply-To: <87k61lq1gm.fsf@gmx.de> 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:62721 Archived-At: This is a multi-part message in MIME format. --------------020309020205030700010002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit >Why didn't you introduce a new variable tramp-copy-failed-regexp? This >would make the code more readable, and it would avoid several changes. > > I didn't want to clobber the name space, but I agree that adding a variable makes my change more consistent with the rest of tramp. >I don't know whether it is possible to cut trailing newlines in >general. Some existing regexps claim "The regexp should match at end >of buffer." > Then we better not change it. My patch, whit your change suggestions is attached. --------------020309020205030700010002 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:39:04.000000000 +0100 --- tramp.el 2006-11-24 16:58:24.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. *************** *** 943,948 **** --- 943,959 ---- :group 'tramp :type 'regexp) + (defcustom tramp-copy-failed-regexp + (concat "\\(.+: " + (regexp-opt '("Permission denied" + "not a regular file" + "is a directory" + "No such file or directory") t) + "\\)\\s-*") + "Regular expression matching copy problems in (s)cp operations." + :group 'tramp + :type 'regexp) + (defcustom tramp-process-alive-regexp "" "Regular expression indicating a process has finished. *************** *** 1340,1345 **** --- 1351,1357 ---- (defcustom tramp-actions-copy-out-of-band '((tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (tramp-copy-failed-regexp 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. *************** *** 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. --- 3186,3198 ---- (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 **** --- 5366,5376 ---- (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))) --- 5427,5432 ---- --------------020309020205030700010002 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 --------------020309020205030700010002--