From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#27986: 26.0.50; `rename-file' can rename files without confirmation Date: Sun, 06 Aug 2017 20:05:09 +0300 Message-ID: <83poc8tynu.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1502039174 25316 195.159.176.226 (6 Aug 2017 17:06:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 6 Aug 2017 17:06:14 +0000 (UTC) Cc: 27986@debbugs.gnu.org To: Philipp Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 06 19:06:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deP0C-0006DE-M5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Aug 2017 19:06:08 +0200 Original-Received: from localhost ([::1]:33836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deP0I-0000Fb-Pq for geb-bug-gnu-emacs@m.gmane.org; Sun, 06 Aug 2017 13:06:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deP0A-0000FC-2v for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 13:06:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1deP06-00039o-PY for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 13:06:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1deP06-00039V-Lz for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 13:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1deP06-00033J-EX for bug-gnu-emacs@gnu.org; Sun, 06 Aug 2017 13:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Aug 2017 17:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27986 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27986-submit@debbugs.gnu.org id=B27986.150203912611688 (code B ref 27986); Sun, 06 Aug 2017 17:06:02 +0000 Original-Received: (at 27986) by debbugs.gnu.org; 6 Aug 2017 17:05:26 +0000 Original-Received: from localhost ([127.0.0.1]:44931 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deOzV-00032R-MT for submit@debbugs.gnu.org; Sun, 06 Aug 2017 13:05:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1deOzU-00032F-5z for 27986@debbugs.gnu.org; Sun, 06 Aug 2017 13:05:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1deOzL-0002l5-Jx for 27986@debbugs.gnu.org; Sun, 06 Aug 2017 13:05:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deOzL-0002kv-GS; Sun, 06 Aug 2017 13:05:15 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3255 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1deOzK-0001QX-Ul; Sun, 06 Aug 2017 13:05:15 -0400 In-reply-to: (message from Philipp on Sun, 06 Aug 2017 17:40:18 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135507 Archived-At: > From: Philipp > Date: Sun, 06 Aug 2017 17:40:18 +0200 > > (rename-file "/tmp/emacs/ẞ" "/tmp/emacs/ß") > nil > > Note how `rename-file' has silently overwritten `ß'. This is because on > macOS, `ß' and `ẞ' are different file names, but Emacs treats them as > equal. Probably the test for case-insensitive file names should be > removed altogether Which one? there are two of them. > (it can't work correctly and introduces a filesystem race) It cannot work correctly _because_ of a possible race or because of some other reasons? If the latter, please elaborate. If the former, then at least on MS-Windows we have a race anyway, because the underlying system APIs are not atomic. So at least on MS-Windows the feature should stay, as it introduces no new issues and supports a valid and quite important use case (the Windows shell supports it as well, so we really cannot do less). > and `rename-file' should use link(2) + unlink(2) if renameat2 > isn't available. 'link' and 'unlink' accept strings as arguments, not integer numbers such as 2. More to the point, how can this strategy work on a case-insensitive filesystem? What am I missing?