From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [juanleon1@gmail.com: Problem at backup-buffer for writable files in not writable dirs] Date: Sat, 19 Mar 2005 19:22:14 -0500 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1111279249 11909 80.91.229.2 (20 Mar 2005 00:40:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Mar 2005 00:40:49 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 20 01:40:49 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DCoUp-0001ZM-7D for ged-emacs-devel@m.gmane.org; Sun, 20 Mar 2005 01:40:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DColc-0001PD-9W for ged-emacs-devel@m.gmane.org; Sat, 19 Mar 2005 19:58:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DCoiN-00005y-Hp for emacs-devel@gnu.org; Sat, 19 Mar 2005 19:54:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DCoiC-0008Qn-Q2 for emacs-devel@gnu.org; Sat, 19 Mar 2005 19:54:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DCoi7-0008ND-3p for emacs-devel@gnu.org; Sat, 19 Mar 2005 19:54:31 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DCoCs-00044Z-KX for emacs-devel@gnu.org; Sat, 19 Mar 2005 19:22:14 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1DCoCs-0006R4-9Y; Sat, 19 Mar 2005 19:22:14 -0500 Original-To: emacs-devel@gnu.org 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 X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34799 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34799 I think this change is correct--does anyone disagree? Would someone please install this on Monday (and thank him) if no objection has been found? ------- Start of forwarded message ------- Date: Fri, 18 Mar 2005 16:17:00 +0100 From: JUAN-LEON Lahoz Garcia To: emacs-pretest-bug@gnu.org Subject: Problem at backup-buffer for writable files in not writable dirs Sender: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org X-Spam-Status: No, hits=0.0 required=5.0 tests=PATCH_UNIFIED_DIFF,RCVD_IN_ORBS version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) Hi, When you edit and save a writable file in a non writable dir, and you have `backup-by-copying' to nil (the default), backup-buffer fails to make a backup in the place user has defined with variable `backup-directory-alist' (because you cannot move files that are in a not writable dir, despite of file ownership), so it copies it to file "~/%backup%~". [ I know having writable files in non writable files is not very usual, but I have to edit some conf files in such directories and I got this ~/%backup%~ file around all the time ] IMHO this one-liner patch solves the problem, by detecting this situation as one of the cases where a copy should be used to backup the file instead of moving. You may want to review and/or apply it. Regards juanleon - --- files.el.ori Thu Mar 10 09:29:31 2005 +++ files.el Thu Mar 10 10:02:00 2005 @@ -2686,6 +2686,7 @@ backup-by-copying ;; Don't rename a suid or sgid file. (and modes (< 0 (logand modes #o6000))) + (not (file-writable-p (file-name-directory real-file-name))) (and backup-by-copying-when-linked (> (file-nlinks real-file-name) 1)) (and (or backup-by-copying-when-mismatch _______________________________________________ Emacs-pretest-bug mailing list Emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug ------- End of forwarded message -------