Re: Dangerous behavior when copying to current directory

2005-03-16 Thread Richard Stallman
Your fix works only for the case where a specified directory has no
final slash.  But after invoking M-x copy-file or M-x rename-file
the default initial value for the second argument has a final slash,
e.g. `/tmp/'.  Since `copy-file' and `rename-file' have interactive
specification `F' for the second argument, when they get called with
the default value after typing RET, the second argument is already
expanded to the wrong file name.

It seems to happen only in some conditions.  The first time I tried
this, it did not happen; the second time, it did.

I fixed this by setting up a new interactive spec.
However, I can't install it easily from here.


___
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Dangerous behavior when copying to current directory

2005-03-10 Thread David Kastrup
Richard Stallman [EMAIL PROTECTED] writes:

 It is not very dangerous, since it asks the user for confirmation.

I just have been bitten by something even worse: namely rename-file.
I wanted to move a file into some other directory.  So I did
M-x rename-file RET somefilename RET /tmp RET

then I got the question

/tmp/ already exists.  Continue?

Well, weird question, but I replied yes to it, figuring that it
would not recursively remove the directory and the worst that could
happen would be that this fails.

What happened is that Emacs took the name of the current buffer and
overwrote the file with that name in /tmp.  I did not notice this
until it told me the file on disk had changed and would I want to
revert.  Thinking it was CVS-related, I did.

Undo did not work, no backup yet.

I recovered the file contents from a mail where I had sent out the
latest version to a customer.

 But it may be inconvenient and annoying.

It is more than that.  Overwriting an unrelated file, and in the case
of rename-file even completely without announcing the file that is
going to suffer the damage, is intolerable.

Even if there is a question file exists when the target is a
directory.

 I agree it would be better to change this.  It is not easy to do,
 since there is no way for a C primitive to use Lisp code to read the
 arguments.

Then it should just refuse to do anything instead of writing over what
amounts to an arbitrary unrelated file.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


___
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Dangerous behavior when copying to current directory

2005-03-10 Thread Richard Stallman
I found a way to fix this to do what people want.


___
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Dangerous behavior when copying to current directory

2005-03-06 Thread Richard Stallman
It is not very dangerous, since it asks the user for confirmation.
But it may be inconvenient and annoying.

I agree it would be better to change this.
It is not easy to do, since there is no way for a C primitive
to use Lisp code to read the arguments.


___
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug