REGARDING: ;; Version: $Id: rcp.el,v 1.147 1999/09/21 13:32:22 grossjoh Exp $
              on Emacs 20.3

THE PROBLEM: If you are browsing a remote directory with rcp.el,
ange-ftp, and dired ("scp" method, but I think all methods are
effected) and you press `C' to copy a remote file to the local
machine, the minibuffer will claim that the copy is successfully made,
but it will not be made.  (Yes, I know that better error-catching is
already on the the todo list.)

ANALYSIS: `call-process' (an Emacs-Lisp primitive) runs its process in
the directory given in `default-directory'.  In a remote dired buffer,
this is a string like "/r:user@host:path/".  The rcp filename handler
functions get called on it.  This isn't a problem I don't think.  But
`call-process' appears to lose.  I haven't checked the C source for
it, but it's not hard to understand why you can't make a system call
in a directory that looks like "/r:user@host:path/".

FIX:  catch bad values of `default-directory' and substitute something
benign like "/tmp".  The diff below works.  

NOTE: Are there other places the same problem will occur?  Scanning
rcp.el briefly, I think maybe handle-write-region.


diff -c /tmp/rcp.el.orig /tmp/rcp.el
*** /tmp/rcp.el.orig    Fri Sep 24 07:17:46 1999
--- /tmp/rcp.el Fri Sep 24 07:19:32 1999
***************
*** 1102,1108 ****
                    (rcp-make-rcp-program-file-name
                     (rcp-file-name-user v2)
                     (rcp-file-name-host v2)
!                    (shell-quote-argument (rcp-file-name-path v2))))))
          (when keep-date
            (add-to-list 'rcp-args (rcp-get-rcp-keep-date-arg meth)))
          (apply #'call-process (rcp-get-rcp-program meth) nil nil nil
--- 1102,1114 ----
                    (rcp-make-rcp-program-file-name
                     (rcp-file-name-user v2)
                     (rcp-file-name-host v2)
!                    (shell-quote-argument (rcp-file-name-path v2)))))
!           (default-directory (if (rcp-rcp-file-p default-directory)
!                                  (concat (or (getenv "TMPDIR")
!                                              (getenv "TEMPDIR")
!                                              "/tmp")
!                                          "/")
!                                default-directory)))
          (when keep-date
            (add-to-list 'rcp-args (rcp-get-rcp-keep-date-arg meth)))
          (apply #'call-process (rcp-get-rcp-program meth) nil nil nil

Diff finished at Fri Sep 24 07:21:39

Reply via email to