From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: creating backups in temporary directories Date: Tue, 11 Sep 2007 14:17:27 -0700 (PDT) Message-ID: <40847.128.165.123.18.1189545447.squirrel@webmail.lanl.gov> References: <85sl5q5vy6.fsf@lola.goethe.zz> <87y7fii7bz.fsf@gmx.de> <85odgbobf0.fsf@lola.goethe.zz> <85bqcbnx30.fsf@lola.goethe.zz> <37852.128.165.123.18.1189451917.squirrel@webmail.lanl.gov> <37871.128.165.123.18.1189452201.squirrel@webmail.lanl.gov> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1189545478 6503 80.91.229.12 (11 Sep 2007 21:17:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 11 Sep 2007 21:17:58 +0000 (UTC) Cc: schwab@suse.de, monnier@iro.umontreal.ca, emacs-pretest-bug@gnu.org, christopher.ian.moore@gmail.com, svenjoac@gmx.de To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 11 23:17:55 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IVD7E-0005ph-TY for ged-emacs-devel@m.gmane.org; Tue, 11 Sep 2007 23:17:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVD7E-0007UR-Cz for ged-emacs-devel@m.gmane.org; Tue, 11 Sep 2007 17:17:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVD7B-0007UH-PB for emacs-devel@gnu.org; Tue, 11 Sep 2007 17:17:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVD7B-0007U5-DD for emacs-devel@gnu.org; Tue, 11 Sep 2007 17:17:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVD7B-0007U2-4G for emacs-devel@gnu.org; Tue, 11 Sep 2007 17:17:45 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVD7A-0006JK-Qd for emacs-devel@gnu.org; Tue, 11 Sep 2007 17:17:45 -0400 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVD6m-0003dq-8q for emacs-pretest-bug@gnu.org; Tue, 11 Sep 2007 17:17:20 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IVD76-0006He-Vm for emacs-pretest-bug@gnu.org; Tue, 11 Sep 2007 17:17:44 -0400 Original-Received: from mailwasher.lanl.gov ([192.65.95.54] helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVD72-0006FH-Hs; Tue, 11 Sep 2007 17:17:36 -0400 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by mailwasher-b.lanl.gov (8.13.8/8.13.6/(ccn-5)) with ESMTP id l8BLHVp0013039; Tue, 11 Sep 2007 15:17:31 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (8.13.8/8.13.8/(ccn-5)) with ESMTP id l8BLHRiL030272; Tue, 11 Sep 2007 15:17:27 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id l8BLHRKs016050; Tue, 11 Sep 2007 15:17:27 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id l8BLHRTq016046; Tue, 11 Sep 2007 14:17:27 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.18 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Tue, 11 Sep 2007 14:17:27 -0700 (PDT) In-Reply-To: User-Agent: SquirrelMail/1.4.8-6.el3.2lanl X-Priority: 3 (Normal) Importance: Normal X-CTN-5-MailScanner-Information: Please see http://network.lanl.gov/email/virus-scan.php X-CTN-5-MailScanner: Found to be clean X-CTN-5-MailScanner-From: herring@lanl.gov X-Detected-Kernel: Linux 2.4-2.6 X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 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:78606 gmane.emacs.pretest.bugs:19850 Archived-At: > The code in backup-buffer-copy already does part of this; > it calls copy-file in a way that uses O_EXCL. Ah. That's good; I was trying to provide a self-contained concept rather than a patch, if you take my meaning. > If /tmp/foo~ already exists, rename it first to > /tmp/backupforthebackup~ > rather than unlinking it; we have to get it out of the way and use > O_EXCL > even if we own it in case the directory's owner is the attacker. > > Why is this needed? When we're doing the copy, the actual source file > also exists. (By "this" you must mean the rename instead of the unlink; I trust that the reason for having to do one or the other was understood.) I guess it's not actually necessary. I was thinking it would be better to reduce the amount of time when there was no backup; but at this point the user wants the current contents of the actual file to _become_ the backup, so the existing backup is completely expendable. (Of course, it gets more complicated with numbered backups...) Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.