all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable
@ 2014-10-03 18:34 Zack Weinberg
  2014-12-21 11:18 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Zack Weinberg @ 2014-10-03 18:34 UTC (permalink / raw)
  To: 18623

`tramp' copies files by invoking a utility program, e.g. `rsync'.  If
that program is unavailable on the local machine, you get the unhelpful
error message `File exists, but cannot be read.'  I was only able to
figure out what was really wrong by bumping `tramp-verbose' and
inspecting the logs.  (I append a sample log.)

Recipe:

Set up two computers, A and B, such that you can `ssh' into your account
on B from your account on A.  Arrange for A not to have `rsync'
installed.  Place a test file `test.txt' in your account on B.

Then, from A, start up Emacs and set `tramp-verbose' to 6.

Then attempt to visit `/rsync:you@B:test.txt' in Emacs.

You should observe the error message `File exists, but cannot be read.'
in the echo area.

You should observe the error message

    tramp-do-copy-or-rename-file-out-of-band (1) # File error: Cannot find
    copy program: rsync

in the *debug tramp/rsync B* buffer, _and nowhere else_; especially, not
in *Messages*.

`Cannot find copy program: rsync' is a perfectly sensible error message;
this bug would be resolved if _that_ were what showed up in the echo area.

--- tramp log ---

;; GNU Emacs: 24.3.1 Tramp: 2.2.6-24.3 -*- mode: outline; -*-
14:19:05.252104 tramp-send-command (6) # echo are you awake
14:19:05.267424 tramp-wait-for-regexp (6) #
are you awake
///b9ac250b8258b97dbbec98c1e1ef1117#$
14:19:05.267725 tramp-send-command (6) # test -e
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js
2>/dev/null; echo tramp_exit_status $?
14:19:05.283083 tramp-wait-for-regexp (6) #
tramp_exit_status 0
///b9ac250b8258b97dbbec98c1e1ef1117#$
14:19:05.284627 tramp-send-command (6) # test -d
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js
2>/dev/null; echo tramp_exit_status $?
14:19:05.299929 tramp-wait-for-regexp (6) #
tramp_exit_status 1
///b9ac250b8258b97dbbec98c1e1ef1117#$
14:19:05.301163 tramp-sh-handle-file-truename (4) # Finding true name
for `/rsync:laguz:/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js'
14:19:05.301410 tramp-send-command (6) # echo "\"`\readlink
--canonicalize-missing
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js`\""
2>/dev/null; echo tramp_exit_status $?
14:19:05.318470 tramp-wait-for-regexp (6) #
"/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js"
tramp_exit_status 0
///b9ac250b8258b97dbbec98c1e1ef1117#$
14:19:05.318752 tramp-sh-handle-file-truename (4) # True name of
`/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js' is
`/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js'
14:19:05.319569 tramp-do-file-attributes-with-stat (5) # file
attributes with stat:
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js
14:19:05.319851 tramp-send-command (6) # ( (test -e
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js || test -h
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js) && \stat
-c '(("%N") %h %ue0 %ge0 %Xe0 %Ye0 %Ze0 %se0 "%A" t %ie0 -1)'
/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js || echo
nil) 2>/dev/null; echo tramp_exit_status $?
14:19:05.338393 tramp-wait-for-regexp (6) #
(("`/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js'") 1
1000e0 1000e0 1410395278e0 1410445328e0 1410445328e0 16933e0
"-rw-r--r--" t 48637e0 -1)
tramp_exit_status 0
///b9ac250b8258b97dbbec98c1e1ef1117#$
14:19:05.343329 tramp-handle-insert-file-contents (3) # Inserting
`/rsync:laguz:/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js'...
14:19:05.376334 tramp-do-copy-or-rename-file (0) # Copying
/rsync:laguz:/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js
to /tmp/tramp.4566iIP.js...
14:19:05.377611 tramp-do-copy-or-rename-file-out-of-band (1) # File
error: Cannot find copy program: rsync
14:19:05.378100 tramp-do-copy-or-rename-file-out-of-band (0) # Copying
/rsync:laguz:/home/tbbscraperentry/tbbscraper/scripts/pj-trace-redir.js
to /tmp/tramp.4566iIP.js...done


--- emacs config details (pruned) --

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.12.2)
 of 2014-09-08 on binet, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11601000
System Description:    Debian GNU/Linux unstable (sid)

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Load-path shadows:
/usr/share/emacs/24.3/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/24.3/lisp/textmodes/ispell
/usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/24.3/lisp/textmodes/flyspell

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils pp cus-edit wid-edit
help-mode vc-git edmacro kmacro js2-mode cc-mode cc-fonts easymenu
cc-guess cc-menus cc-styles cc-align cc-cmds cc-engine cc-vars cc-defs
imenu tramp-cmds noutline outline easy-mmode tramp-cache tramp-sh paren
cus-start cus-load tramp tramp-compat auth-source eieio byte-opt
bytecomp byte-compile cconv gnus-util mm-util mail-prsvr password-cache
tramp-loaddefs shell pcomplete comint ansi-color ring format-spec advice
help-fns cl-lib advice-preload time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable
  2014-10-03 18:34 bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable Zack Weinberg
@ 2014-12-21 11:18 ` Michael Albinus
  2015-02-17 21:44   ` Zack Weinberg
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2014-12-21 11:18 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: 18623

Zack Weinberg <zackw@panix.com> writes:

> `Cannot find copy program: rsync' is a perfectly sensible error message;
> this bug would be resolved if _that_ were what showed up in the echo area.

I've committed the following patch to the Tramp repo as well as to the
Emacs repo (branch emacs-24):

--8<---------------cut here---------------start------------->8---
*** /tmp/ediff13503WDN	2014-12-21 12:15:48.715138335 +0100
--- /home/albinus/src/tramp/lisp/tramp.el	2014-12-21 11:30:14.424791817 +0100
***************
*** 3086,3200 ****
    (setq filename (expand-file-name filename))
    (let (result local-copy remote-copy)
      (with-parsed-tramp-file-name filename nil
!       (with-tramp-progress-reporter
! 	  v 3 (format "Inserting `%s'" filename)
! 	(unwind-protect
! 	    (if (not (file-exists-p filename))
! 		(progn
! 		  ;; We don't raise a Tramp error, because it might be
! 		  ;; suppressed, like in `find-file-noselect-1'.
! 		  (tramp-message
! 		   v 1 "File not `%s' found on remote host" filename)
! 		  (signal 'file-error
! 			  (list "File not found on remote host" filename)))
! 
! 	      (if (and (tramp-local-host-p v)
! 		       (let (file-name-handler-alist)
! 			 (file-readable-p localname)))
! 		  ;; Short track: if we are on the local host, we can
! 		  ;; run directly.
! 		  (setq result
! 			(tramp-run-real-handler
! 			 'insert-file-contents
! 			 (list localname visit beg end replace)))
! 
! 		;; When we shall insert only a part of the file, we
! 		;; copy this part.  This works only for the shell file
! 		;; name handlers.
! 		(when (and (or beg end)
! 			   (tramp-get-method-parameter
! 			    (tramp-file-name-method v) 'tramp-login-program))
! 		  (setq remote-copy (tramp-make-tramp-temp-file v))
! 		  ;; This is defined in tramp-sh.el.  Let's assume
! 		  ;; this is loaded already.
! 		  (tramp-compat-funcall
! 		   'tramp-send-command
! 		   v
! 		   (cond
! 		    ((and beg end)
! 		     (format "dd bs=1 skip=%d if=%s count=%d of=%s"
! 			     beg (tramp-shell-quote-argument localname)
! 			     (- end beg) remote-copy))
! 		    (beg
! 		     (format "dd bs=1 skip=%d if=%s of=%s"
! 			     beg (tramp-shell-quote-argument localname)
! 			     remote-copy))
! 		    (end
! 		     (format "dd bs=1 count=%d if=%s of=%s"
! 			     end (tramp-shell-quote-argument localname)
! 			     remote-copy))))
! 		  (setq tramp-temp-buffer-file-name nil beg nil end nil))
! 
! 		;; `insert-file-contents-literally' takes care to
! 		;; avoid calling jka-compr.  By let-binding
! 		;; `inhibit-file-name-operation', we propagate that
! 		;; care to the `file-local-copy' operation.
! 		(setq local-copy
! 		      (let ((inhibit-file-name-operation
! 			     (when (eq inhibit-file-name-operation
! 				       'insert-file-contents)
! 			       'file-local-copy)))
! 			(cond
! 			 ((stringp remote-copy)
! 			  (file-local-copy
! 			   (tramp-make-tramp-file-name
! 			    method user host remote-copy)))
! 			 ((stringp tramp-temp-buffer-file-name)
! 			  (copy-file filename tramp-temp-buffer-file-name 'ok)
! 			  tramp-temp-buffer-file-name)
! 			 (t (file-local-copy filename)))))
! 
! 		;; When the file is not readable for the owner, it
! 		;; cannot be inserted, even if it is readable for the
! 		;; group or for everybody.
! 		(set-file-modes
! 		 local-copy (tramp-compat-octal-to-decimal "0600"))
! 
! 		(when (and (null remote-copy)
! 			   (tramp-get-method-parameter
! 			    method 'tramp-copy-keep-tmpfile))
! 		  ;; We keep the local file for performance reasons,
! 		  ;; useful for "rsync".
! 		  (setq tramp-temp-buffer-file-name local-copy))
! 
! 		;; We must ensure that `file-coding-system-alist'
! 		;; matches `local-copy'.  We must also use `visit',
! 		;; otherwise there might be an error in the
! 		;; `revert-buffer' function under XEmacs.
! 		(let ((file-coding-system-alist
! 		       (tramp-find-file-name-coding-system-alist
! 			filename local-copy)))
! 		  (setq result
! 			(insert-file-contents
! 			 local-copy visit beg end replace)))))
! 
! 	  ;; Save exit.
! 	  (progn
! 	    (when visit
! 	      (setq buffer-file-name filename)
! 	      (setq buffer-read-only (not (file-writable-p filename)))
! 	      (set-visited-file-modtime)
! 	      (set-buffer-modified-p nil))
! 	    (when (and (stringp local-copy)
! 		       (or remote-copy (null tramp-temp-buffer-file-name)))
! 	      (delete-file local-copy))
! 	    (when (stringp remote-copy)
! 	      (delete-file
! 	       (tramp-make-tramp-file-name method user host remote-copy)))))))
! 
!     ;; Result.
!     (list (expand-file-name filename)
! 	  (cadr result))))
  
  (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
    "Like `load' for Tramp files."
--- 3086,3202 ----
    (setq filename (expand-file-name filename))
    (let (result local-copy remote-copy)
      (with-parsed-tramp-file-name filename nil
!       (unwind-protect
! 	  (if (not (file-exists-p filename))
! 	      (tramp-message v 0 "(New file)")
! 
! 	    (with-tramp-progress-reporter
! 		v 3 (format "Inserting `%s'" filename)
! 	      (condition-case err
! 		  (if (and (tramp-local-host-p v)
! 			   (let (file-name-handler-alist)
! 			     (file-readable-p localname)))
! 		      ;; Short track: if we are on the local host, we can
! 		      ;; run directly.
! 		      (setq result
! 			    (tramp-run-real-handler
! 			     'insert-file-contents
! 			     (list localname visit beg end replace)))
! 
! 		    ;; When we shall insert only a part of the file, we
! 		    ;; copy this part.  This works only for the shell file
! 		    ;; name handlers.
! 		    (when (and (or beg end)
! 			       (tramp-get-method-parameter
! 				(tramp-file-name-method v)
! 				'tramp-login-program))
! 		      (setq remote-copy (tramp-make-tramp-temp-file v))
! 		      ;; This is defined in tramp-sh.el.  Let's assume
! 		      ;; this is loaded already.
! 		      (tramp-compat-funcall
! 		       'tramp-send-command
! 		       v
! 		       (cond
! 			((and beg end)
! 			 (format "dd bs=1 skip=%d if=%s count=%d of=%s"
! 				 beg (tramp-shell-quote-argument localname)
! 				 (- end beg) remote-copy))
! 			(beg
! 			 (format "dd bs=1 skip=%d if=%s of=%s"
! 				 beg (tramp-shell-quote-argument localname)
! 				 remote-copy))
! 			(end
! 			 (format "dd bs=1 count=%d if=%s of=%s"
! 				 end (tramp-shell-quote-argument localname)
! 				 remote-copy))))
! 		      (setq tramp-temp-buffer-file-name nil beg nil end nil))
! 
! 		    ;; `insert-file-contents-literally' takes care to
! 		    ;; avoid calling jka-compr.  By let-binding
! 		    ;; `inhibit-file-name-operation', we propagate that
! 		    ;; care to the `file-local-copy' operation.
! 		    (setq local-copy
! 			  (let ((inhibit-file-name-operation
! 				 (when (eq inhibit-file-name-operation
! 					   'insert-file-contents)
! 				   'file-local-copy)))
! 			    (cond
! 			     ((stringp remote-copy)
! 			      (file-local-copy
! 			       (tramp-make-tramp-file-name
! 				method user host remote-copy)))
! 			     ((stringp tramp-temp-buffer-file-name)
! 			      (copy-file
! 			       filename tramp-temp-buffer-file-name 'ok)
! 			      tramp-temp-buffer-file-name)
! 			     (t (file-local-copy filename)))))
! 
! 		    ;; When the file is not readable for the owner, it
! 		    ;; cannot be inserted, even if it is readable for the
! 		    ;; group or for everybody.
! 		    (set-file-modes
! 		     local-copy (tramp-compat-octal-to-decimal "0600"))
! 
! 		    (when (and (null remote-copy)
! 			       (tramp-get-method-parameter
! 				method 'tramp-copy-keep-tmpfile))
! 		      ;; We keep the local file for performance reasons,
! 		      ;; useful for "rsync".
! 		      (setq tramp-temp-buffer-file-name local-copy))
! 
! 		    ;; We must ensure that `file-coding-system-alist'
! 		    ;; matches `local-copy'.  We must also use `visit',
! 		    ;; otherwise there might be an error in the
! 		    ;; `revert-buffer' function under XEmacs.
! 		    (let ((file-coding-system-alist
! 			   (tramp-find-file-name-coding-system-alist
! 			    filename local-copy)))
! 		      (setq result
! 			    (insert-file-contents
! 			     local-copy visit beg end replace))))
! 		(error
! 		 (add-hook 'find-file-not-found-functions
! 			   `(lambda () (signal ',(car err) ',(cdr err)))
! 			   nil t)
! 		 (signal (car err) (cdr err))))))
! 
! 	;; Save exit.
! 	(progn
! 	  (when visit
! 	    (setq buffer-file-name filename)
! 	    (setq buffer-read-only (not (file-writable-p filename)))
! 	    (set-visited-file-modtime)
! 	    (set-buffer-modified-p nil))
! 	  (when (and (stringp local-copy)
! 		     (or remote-copy (null tramp-temp-buffer-file-name)))
! 	    (delete-file local-copy))
! 	  (when (stringp remote-copy)
! 	    (delete-file
! 	     (tramp-make-tramp-file-name method user host remote-copy)))))
! 
!       ;; Result.
!       (list (expand-file-name filename)
! 	    (cadr result)))))
  
  (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
    "Like `load' for Tramp files."
--8<---------------cut here---------------end--------------->8---

Could you, please, check whether it fits your needs?

Best regards, Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable
  2014-12-21 11:18 ` Michael Albinus
@ 2015-02-17 21:44   ` Zack Weinberg
  2015-02-18  8:31     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Zack Weinberg @ 2015-02-17 21:44 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 18623

I'm sorry it took me so long to get back to you about this.  I
couldn't figure out from the patch whether it would fix the problem,
so I had to find time to actually test it, and I've been very busy the
past few months.  Anyway, with this patch applied I get a nice clear
error message in the echo area when rsync isn't available on a remote
accessed via /rsync:hostname.  Thanks for fixing.

zw





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable
  2015-02-17 21:44   ` Zack Weinberg
@ 2015-02-18  8:31     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2015-02-18  8:31 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: 18623-done

Version: 24.5

Zack Weinberg <zackw@panix.com> writes:

> Anyway, with this patch applied I get a nice clear
> error message in the echo area when rsync isn't available on a remote
> accessed via /rsync:hostname.  Thanks for fixing.

Thanks for checking, I'm closing the bug.

> zw

Best regards, Michael.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-18  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03 18:34 bug#18623: 24.3; tramp: unhelpful error message when copy program is unavailable Zack Weinberg
2014-12-21 11:18 ` Michael Albinus
2015-02-17 21:44   ` Zack Weinberg
2015-02-18  8:31     ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.