From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Bugfix and improved error handling Date: Thu, 23 Nov 2006 22:48:09 +0100 Message-ID: <87k61lq1gm.fsf@gmx.de> References: <456351DB.8010805@soem.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164402160 29250 80.91.229.2 (24 Nov 2006 21:02:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2006 21:02:40 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 24 22:02:36 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 1GniBt-0001ek-Co for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2006 22:02:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GniBs-0001J2-RS for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2006 16:02:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GniBZ-0001HW-V4 for emacs-devel@gnu.org; Fri, 24 Nov 2006 16:02:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GniBY-0001GU-DR for emacs-devel@gnu.org; Fri, 24 Nov 2006 16:02:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GniBY-0001GP-9o for emacs-devel@gnu.org; Fri, 24 Nov 2006 16:02:12 -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 1Gni7o-00047A-MR for emacs-devel@gnu.org; Fri, 24 Nov 2006 15:58:20 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by mx20.gnu.org with smtp (Exim 4.52) id 1GnMSR-0004C5-Or for emacs-devel@gnu.org; Thu, 23 Nov 2006 16:50:13 -0500 Original-Received: (qmail invoked by alias); 23 Nov 2006 21:48:09 -0000 Original-Received: from p54BD81F1.dip0.t-ipconnect.de (EHLO localhost.local) [84.189.129.241] by mail.gmx.net (mp022) with SMTP; 23 Nov 2006 22:48:09 +0100 X-Authenticated: #3708877 Original-To: Lars Hansen In-Reply-To: <456351DB.8010805@soem.dk> (Lars Hansen's message of "Tue, 21 Nov 2006 20:22:03 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) X-Y-GMX-Trusted: 0 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:62734 Archived-At: Lars Hansen writes: Hi Lars, > 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? In general the patch looks OK to me. > --- 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) 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. > --- 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))) 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." Likely you are right in your change, but then you could remove trailing "\\s-*" from several regexps. It would be more consistent. Best regards, Michael.