From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: Race-condition ? Date: Sun, 03 Jul 2005 11:49:03 -0400 Message-ID: References: Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1120406796 8802 80.91.229.2 (3 Jul 2005 16:06:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2005 16:06:36 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 03 18:06:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dp6z7-0002qU-Dj for ged-emacs-devel@m.gmane.org; Sun, 03 Jul 2005 18:06:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dp70H-0008La-KB for ged-emacs-devel@m.gmane.org; Sun, 03 Jul 2005 12:07:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dp6vD-0006Wh-NM for emacs-devel@gnu.org; Sun, 03 Jul 2005 12:02:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dp6v1-0006Q3-9T for emacs-devel@gnu.org; Sun, 03 Jul 2005 12:02:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dp6uz-0006AL-D8 for emacs-devel@gnu.org; Sun, 03 Jul 2005 12:02:05 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dp6py-0007s7-B6 for emacs-devel@gnu.org; Sun, 03 Jul 2005 11:56:54 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1Dp6iN-0005qq-Nz; Sun, 03 Jul 2005 11:49:03 -0400 Original-To: gaetan.leurent@ens.fr In-reply-to: (gaetan.leurent@ens.fr) 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:40220 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40220 Some (including GNU mv and GNU cp) do even use chown and chmod in the same unsafe way that we did previously, so I will report that to them. Thank you. Now, as for as I can tell, there is no way to move a file asking the user what to do if needed and avoid every race-conditions in a Unix-like OS. I will try to come with a solution that avoids the worse problems. That is good. Those two ways will have different effects if the file we overwrite/remove has a link count > 1. Current emacs implementation use "overwrite mode" in copy and "remove mode" in rename if it is in the same filesystem, Those are clearly the right things. copy-file is defined to overwrite an existing file; it would be wrong to do anything else (at least in the default case). Rename, in the case where it is implemented by the rename system call, will replace the existing file. but cross-filesystem rename use the "overwrite mode". In principle, that ought to replace the existing file, to be consistent with other cases of renaming. The easiest way might be to create an option (or reuse an existing option) in copy-file, so that rename-file can continue to handle this case by calling copy-file.