[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bugfix and improved error handling

From: Michael Albinus
Subject: Re: Bugfix and improved error handling
Date: Thu, 23 Nov 2006 22:48:09 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)

Lars Hansen <address@hidden> 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

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]