From: Lars Hansen <lists@soem.dk>
Cc: emacs-devel@gnu.org
Subject: Re: Bugfix and improved error handling
Date: Fri, 24 Nov 2006 17:28:10 +0100 [thread overview]
Message-ID: <45671D9A.3050209@soem.dk> (raw)
In-Reply-To: <87k61lq1gm.fsf@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
>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.
[-- Attachment #2: tramp.diff --]
[-- Type: text/x-patch, Size: 3740 bytes --]
*** /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 ----
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-11-24 16:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-21 19:22 Bugfix and improved error handling Lars Hansen
2006-11-23 21:48 ` Michael Albinus
2006-11-24 16:28 ` Lars Hansen [this message]
2006-11-24 17:35 ` Michael Albinus
2006-11-24 19:17 ` Lars Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45671D9A.3050209@soem.dk \
--to=lists@soem.dk \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).