all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug in built-in function copy-file
@ 2002-06-30 10:26 Barman Brakjoller
  2002-07-01  4:45 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Barman Brakjoller @ 2002-06-30 10:26 UTC (permalink / raw)


I think I have found a bug in how copy-file works, at least on my
Windows 2000 system. See below for how to reproduce it:

(The reason for using eshell to describe this "bug" is that it is easy
to follow what I'm doing. I am NOT trying to report an eshell error
here.)

c:/tst $ echo file1 > file1
c:/tst $ echo file2 > file2
c:/tst $ attrib +r file1
c:/tst $ ll
total 0
-r--r--r--   1 Barman B 5               5 jun 30 11:11 file1
-rw-rw-rw-   1 Barman B 5               5 jun 30 11:11 file2
c:/tst $ (copy-file "file2" "file1" t)
Copying file: invalid argument, c:/tst/file2, c:/tst/file1

You may not think this is a bug, but I think so. I think copy-file
should either:

a) report a error message that actually tells the user what the
    problem is (you have to agree that "invalid argument" when trying
    to copy one file to another does not tell the user very much)

b) try to handle the read-only file in the same way that save-buffer
    and write-file does, i.e asking user for permission to overwrite
    the file, then try to temporarily change the file permission bits
    (if the file is not writable), write the file and restore the file
    permission bits.

c) add a new optional argument to copy-file so that it works
something like in b) above, but without the confirmation

I'd think that b) and/or c) would be the preferred way to solve this.

Btw, the same procedure in Linux (using chmod instead of attrib of
course) gives the following error message (which is much better):

Opening output file: permission denied, /tmp/file1

So at least there is an inconsistency in how this is handled on the
two systems I have tested on.

I'm using GNU Emacs 21.1.1 on Windows 2000 and Mandrake Linux 8.0.



_________________________________________________________________
På MSN hittar du det roliga, intressanta och användbara på internet: 
http://www.msn.se

^ permalink raw reply	[flat|nested] 3+ messages in thread
* bug in built-in function copy-file
@ 2002-06-30 10:21 Barman Brakjoller
  0 siblings, 0 replies; 3+ messages in thread
From: Barman Brakjoller @ 2002-06-30 10:21 UTC (permalink / raw)


I think I have found a bug in how copy-file works, at least on my
Windows 2000 system. See below for how to reproduce it:

(The reason for using eshell to describe this "bug" is that it is easy
to follow what I'm doing. I am NOT trying to report an eshell error
here.)

c:/tst $ echo file1 > file1
c:/tst $ echo file2 > file2
c:/tst $ attrib +r file1
c:/tst $ ll
total 0
-r--r--r--   1 Barman B 5               5 jun 30 11:11 file1
-rw-rw-rw-   1 Barman B 5               5 jun 30 11:11 file2
c:/tst $ (copy-file "file2" "file1" t)
Copying file: invalid argument, c:/tst/file2, c:/tst/file1

You may not think this is a bug, but I think so. I think copy-file
should either:

 a) report a error message that actually tells the user what the
    problem is (you have to agree that "invalid argument" when trying
    to copy one file to another does not tell the user very much)

 b) try to handle the read-only file in the same way that save-buffer
    and write-file does, i.e asking user for permission to overwrite
    the file, then try to temporarily change the file permission bits
    (if the file is not writable), write the file and restore the file
    permission bits.

 c) add a new optional argument to copy-file so that it works
 something like in b) above, but without the confirmation

I'd think that b) and/or c) would be the preferred way to solve this.

Btw, the same procedure in Linux (using chmod instead of attrib of
course) gives the following error message (which is much better):

 Opening output file: permission denied, /tmp/file1

So at least there is an inconsistency in how this is handled on the
two systems I have tested on.

I'm using GNU Emacs 21.1.1 on Windows 2000 and Mandrake Linux 8.0.

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

end of thread, other threads:[~2002-07-01  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-30 10:26 bug in built-in function copy-file Barman Brakjoller
2002-07-01  4:45 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2002-06-30 10:21 Barman Brakjoller

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.