tramp-devel
[Top][All Lists]
Advanced

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

Re: copy-file-doesn't work (was: Tramp ftp bug (was: ange-ftp-name-forma


From: Eli Zaretskii
Subject: Re: copy-file-doesn't work (was: Tramp ftp bug (was: ange-ftp-name-format needs to be improved))
Date: Mon, 02 Feb 2004 22:57:48 +0200

> From: Michael Albinus <address@hidden>
> Date: Mon, 02 Feb 2004 20:53:41 +0100
> 
> Hmm. Interesting enough, it doesn't seem to be related to Tramp or
> ange-ftp. There's even the same problem copying the file locally:
> 
> (copy-file "~/.emacs" "/tmp/")
> 
> Debugger entered--Lisp error: (file-already-exists "File already exists" 
> "/home/albinus/.emacs")
>   copy-file("~/.emacs" "/tmp/")
>   eval((copy-file "~/.emacs" "/tmp/"))
>   eval-expression((copy-file "~/.emacs" "/tmp/") nil)
>   call-interactively(eval-expression)
> 
> Of course, "/home/albinus/.emacs" does exists, and "/tmp/.emacs"
> doesn't.
> 
> The problem is not evident with Emacs 21.3.

It's a simple bug in copy-file; thanks for bringing this to our
attention.

Please try the patch below.

2004-02-02  Eli Zaretskii  <address@hidden>

        * fileio.c (Fcopy_file): If NEWNAME is a directory, expand the
        basename of FILE relative to it, not FILE itself.

Index: src/fileio.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/fileio.c,v
retrieving revision 1.497
retrieving revision 1.498
diff -u -p -r1.497 -r1.498
--- src/fileio.c        31 Jan 2004 04:24:23 -0000      1.497
+++ src/fileio.c        2 Feb 2004 20:51:18 -0000       1.498
@@ -2407,7 +2407,7 @@ Also set the file modes of the target fi
   CHECK_STRING (newname);
 
   if (!NILP (Ffile_directory_p (newname)))
-    newname = Fexpand_file_name (file, newname);
+    newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
   else
     newname = Fexpand_file_name (newname, Qnil);
 




reply via email to

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