From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#27986: 26.0.50; 'rename-file' can rename files without confirmation Date: Mon, 14 Aug 2017 16:58:04 +0000 Message-ID: References: <61980dde-3d68-7200-e7f4-98f62e410060@cs.ucla.edu> <0e80a1cf-8217-9e9a-a00f-9fdbd6575fc4@cs.ucla.edu> <83pobygo3d.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11c033d68fcb030556b9915a" X-Trace: blaine.gmane.org 1502729961 23329 195.159.176.226 (14 Aug 2017 16:59:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 14 Aug 2017 16:59:21 +0000 (UTC) Cc: 27986@debbugs.gnu.org To: Eli Zaretskii , Paul Eggert , Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 14 18:59:16 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 1dhIhq-0005PG-VH for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Aug 2017 18:59:11 +0200 Original-Received: from localhost ([::1]:34818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhIhv-0006Xe-R5 for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Aug 2017 12:59:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhIhm-0006WU-Su for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2017 12:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhIhi-00074L-TF for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2017 12:59:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhIhi-000748-PP for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2017 12:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dhIhi-0005G6-C7 for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2017 12:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Aug 2017 16:59: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: patch Original-Received: via spool by 27986-submit@debbugs.gnu.org id=B27986.150272990220206 (code B ref 27986); Mon, 14 Aug 2017 16:59:02 +0000 Original-Received: (at 27986) by debbugs.gnu.org; 14 Aug 2017 16:58:22 +0000 Original-Received: from localhost ([127.0.0.1]:35913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhIh4-0005Fq-48 for submit@debbugs.gnu.org; Mon, 14 Aug 2017 12:58:22 -0400 Original-Received: from mail-oi0-f45.google.com ([209.85.218.45]:34673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhIh2-0005Fk-B5 for 27986@debbugs.gnu.org; Mon, 14 Aug 2017 12:58:20 -0400 Original-Received: by mail-oi0-f45.google.com with SMTP id x3so89623595oia.1 for <27986@debbugs.gnu.org>; Mon, 14 Aug 2017 09:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yYhtth6errfNDJz2MSn+pg/55IdlvbTbEjlBbfiMGmk=; b=MgMMxdUljGfuMdpQlGOXAFlK5msHYMcHqvSFkwE79TGp/uPDBf0LBTJPIPbUNQcGSi xLSGWkFfN8LARj5QGsLJ6tFNS88oT+KdGoLKZ3buvUcjQR/fa5KDoxAa8CZ0wNdWgO9H UVIeRG7AQhPJ2/IW/M903qntwQCP0nczPq2EOsANwjnyZJ3RDjEpeFHsROUiOeZhhf2Y IBNHKpSXnfVwssUf+WP4lnZF9bP9hPexdz/8rESXBY3VwPK/jCLKUwTZPIp2t4Kllw5G zrg1ymPxWlQpOlI1ibvHXilysihJ0oPRQI23TxFudASFM8YIoOrKprFyVFUavU1HhbJd kjsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yYhtth6errfNDJz2MSn+pg/55IdlvbTbEjlBbfiMGmk=; b=H8gStFf38h2h9EPZ94rgvXbz2EjRjB6JihBAzsZdX4YFzYWbtohsVS91rzooW6TCr0 7v4kS7ZLUQJ+fe4pTJC0WyepP7oKa9+ibDt5YXRe6dlXjdAhtenYscVasKniKOUIZWLI EwRdani03VNMU0kIzNDeha6fwOGVGUcqpbjQ+jhDXBt8FDByw0GN3kzPKwehe1lCA6Au ReMkhx0yc0k8If1NKE6spJgZ8HbmV0WMQSMT9m5EBNKkwld6GLzfh1KYuI2sHws2gwMf dLfLYXU7wgpe/iRCB6Nj3lZ7fykejlE5UknNyUg3O/3/dnjaOuV3es54ab9CaULq5vwS O9AQ== X-Gm-Message-State: AHYfb5hRIWrjF5OSLIICfzcYCBO+ElEn9yifjYYzWgt4Fr06oQtz9goY vNFIFwwqyZjDeER3ozkDSPSUaSm84Q== X-Received: by 10.202.4.208 with SMTP id 199mr26949854oie.182.1502729894610; Mon, 14 Aug 2017 09:58:14 -0700 (PDT) In-Reply-To: <83pobygo3d.fsf@gnu.org> 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:135751 Archived-At: --001a11c033d68fcb030556b9915a Content-Type: text/plain; charset="UTF-8" Eli Zaretskii schrieb am Mo., 14. Aug. 2017 um 17:34 Uhr: > > From: Paul Eggert > > Cc: Eli Zaretskii , 27986@debbugs.gnu.org > > Date: Sun, 13 Aug 2017 16:48:59 -0700 > > > > Getting back to Philipp's original bug report, Apple documentation says > macOS > > has a facility like the Linux renameat2 system call (i.e., it's like > 'renameat' > > except it can be told to fail if the destination already exists). > Attached is a > > proposed patch to use this facility, which means that the > case-insensitivity > > test would no longer need to be done in macOS. If there's some way to > implement > > renameat_noreplace on MS-Windows we could get rid of the > case-insensitivity test > > there too. > > There's nothing easier than implementing renameat_noreplace on > MS-Windows, since the underlying system call does that by default, and > it's emulating the Posix behavior that requires complications. > You might be able to eliminate these complications by calling MoveFileExW with MOVEFILE_REPLACE_EXISTING. --001a11c033d68fcb030556b9915a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= Mo., 14. Aug. 2017 um 17:34=C2=A0Uhr:
> From: Paul Eggert <eggert@cs.ucla.edu>
> Cc: Eli Zaretskii <eliz@gnu.org>, 27986@debbugs.gnu.org
> Date: Sun, 13 Aug 2017 16:48:59 -0700
>
> Getting back to Philipp's original bug report, Apple documentation= says macOS
> has a facility like the Linux renameat2 system call (i.e., it's li= ke 'renameat'
> except it can be told to fail if the destination already exists). Atta= ched is a
> proposed patch to use this facility, which means that the case-insensi= tivity
> test would no longer need to be done in macOS. If there's some way= to implement
> renameat_noreplace on MS-Windows we could get rid of the case-insensit= ivity test
> there too.

There's nothing easier than implementing renameat_noreplace on
MS-Windows, since the underlying system call does that by default, and
it's emulating the Posix behavior that requires complications.

You might be able to eliminate these complicati= ons by calling MoveFileExW with MOVEFILE_REPLACE_EXISTING.
--001a11c033d68fcb030556b9915a--