[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bugfix and improved error handling
From: |
Lars Hansen |
Subject: |
Re: Bugfix and improved error handling |
Date: |
Fri, 24 Nov 2006 17:28:10 +0100 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20060926) |
>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.
*** /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 ----