From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eli Zaretskii" Newsgroups: gmane.emacs.devel Subject: Trouble with backing up files Date: Sun, 24 Apr 2005 15:21:08 +0300 Message-ID: <01c548c8$Blat.v2.4$3d433180@zahav.net.il> Reply-To: Eli Zaretskii NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1114345178 31712 80.91.229.2 (24 Apr 2005 12:19:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 24 Apr 2005 12:19:38 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 24 14:19:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DPg57-0004Gn-OY for ged-emacs-devel@m.gmane.org; Sun, 24 Apr 2005 14:19:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DPgAR-00081u-9N for ged-emacs-devel@m.gmane.org; Sun, 24 Apr 2005 08:24:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DPgAH-00081p-Ox for emacs-devel@gnu.org; Sun, 24 Apr 2005 08:24:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DPgAG-00081d-7j for emacs-devel@gnu.org; Sun, 24 Apr 2005 08:24:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DPgAG-0007sM-3L for emacs-devel@gnu.org; Sun, 24 Apr 2005 08:24:44 -0400 Original-Received: from [192.114.186.24] (helo=legolas.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DPgBD-0003p5-1Z; Sun, 24 Apr 2005 08:25:43 -0400 Original-Received: from zaretski (IGLD-80-230-58-44.inter.net.il [80.230.58.44]) by legolas.inter.net.il (MOS 3.5.6-GR) with ESMTP id EFO82858 (AUTH halo1); Sun, 24 Apr 2005 15:22:28 +0300 (IDT) Original-To: rms@gnu.org X-Mailer: emacs 22.0.50 (via feedmail 8 I) and Blat ver 2.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36326 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36326 These recent changes: (backup-buffer-copy, basic-save-buffer-2): Take care against writing thru an unexpected existing symlink. break saving of precious files (those for which file-precious-flag is non-nil): Emacs always says that it cannot backup the file, and tries to back it up in ~/%backup%~ (which also fails: it creates an empty file by that name, but doesn't write the original file's contents there). I tracked the problem to this snippet in backup-buffer-copy: (while (condition-case () (progn (condition-case nil (delete-file to-name) (file-error nil)) (write-region "" nil to-name nil 'silent nil 'excl) nil) (file-already-exists t)) ;; the file was somehow created by someone else between ;; `make-temp-name' and `write-region', let's try again. nil) (copy-file from-name to-name t t 'excl)) This deletes the destination file to-name, then creates an empty file by the same name. It then attempts to copy the material from the original file from-name by calling copy-file with the new arg MUSTBENEW set to `excl', which of course fails, since we just created a file by that name when write-region was called. For now, I fixed this by removing the `excl' arg from the call to copy-file, but I'm not sure this is the right fix, since this is the only place where copy-file is called with that argument, and so the reason for introducing it is unclear. Richard, could you please explain why you made those changes and perhaps also say a few words about the implementation, including the need for the new optional arg of copy-file?