From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: brakjoller@hotmail.com (Barman Brakjoller) Newsgroups: gmane.emacs.bugs Subject: bug in built-in function copy-file Date: 30 Jun 2002 03:21:40 -0700 Organization: http://groups.google.com/ Sender: bug-gnu-emacs-admin@gnu.org Message-ID: <1c58a7c3.0206300221.7ca01f42@posting.google.com> NNTP-Posting-Host: localhost.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1025432635 19994 127.0.0.1 (30 Jun 2002 10:23:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 30 Jun 2002 10:23:55 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Obs2-0005CG-00 for ; Sun, 30 Jun 2002 12:23:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17ObsR-0005Lf-00; Sun, 30 Jun 2002 06:24:19 -0400 Original-Received: from chx400.switch.ch ([130.59.10.2]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Obpx-00059R-00 for ; Sun, 30 Jun 2002 06:21:45 -0400 Original-Received: from smtp8.google.com ([216.239.33.28]) by chx400.switch.ch with esmtp (Exim 3.20 #1) id 17Obpw-0007GK-00 for gnu-emacs-bug@moderators.isc.org; Sun, 30 Jun 2002 12:21:44 +0200 Original-Received: from sjins2.sj.google.com (proxy.google.com [216.239.35.5]) by smtp8.google.com (8.12.2/8.12.3) with ESMTP id g5UALfX5019718 for ; Sun, 30 Jun 2002 03:21:41 -0700 Original-Received: from sjmm36.sj.google.com (sjmm36.prod.google.com [10.6.39.36]) by sjins2.sj.google.com (8.9.3/8.9.3) with ESMTP id DAA06258 for ; Sun, 30 Jun 2002 03:21:37 -0700 Original-Received: (from news@localhost) by sjmm36.sj.google.com (8.9.3/8.9.3) id DAA19249 for gnu-emacs-bug@moderators.isc.org; Sun, 30 Jun 2002 03:21:40 -0700 Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 44 Original-NNTP-Posting-Host: 212.181.21.115 Original-X-Trace: posting.google.com 1025432500 19248 127.0.0.1 (30 Jun 2002 10:21:40 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: 30 Jun 2002 10:21:40 GMT Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:2349 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:2349 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.