unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: brakjoller@hotmail.com (Barman Brakjoller)
Subject: bug in built-in function copy-file
Date: 30 Jun 2002 03:21:40 -0700	[thread overview]
Message-ID: <1c58a7c3.0206300221.7ca01f42@posting.google.com> (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.

             reply	other threads:[~2002-06-30 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-30 10:21 Barman Brakjoller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-06-30 10:26 bug in built-in function copy-file Barman Brakjoller
2002-07-01  4:45 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c58a7c3.0206300221.7ca01f42@posting.google.com \
    --to=brakjoller@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).