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#28023: fix make-temp-file race on local host Date: Thu, 10 Aug 2017 18:35:05 +0300 Message-ID: <83d183safq.fsf@gnu.org> References: <8c2c16ff-94ec-a691-57b1-bab8f5b39dfb@cs.ucla.edu> <83poc4sp4z.fsf@gnu.org> <2ca18723-8d62-11f7-86d8-3e0fc044ac57@cs.ucla.edu> <83lgmssglm.fsf@gnu.org> <704c73b8-54f1-f7ac-821b-6d715a21a8a2@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1502379375 25837 195.159.176.226 (10 Aug 2017 15:36:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 10 Aug 2017 15:36:15 +0000 (UTC) Cc: 28023@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 10 17:36:11 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 1dfpVF-0006Ek-Um for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Aug 2017 17:36:06 +0200 Original-Received: from localhost ([::1]:53688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfpVM-0008Kc-Cf for geb-bug-gnu-emacs@m.gmane.org; Thu, 10 Aug 2017 11:36:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfpVE-0008KW-I0 for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 11:36:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfpVB-000443-Ut for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 11:36:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dfpVB-00043u-RV for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 11:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dfpVB-0004bP-K8 for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2017 11:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Aug 2017 15:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28023 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 28023-submit@debbugs.gnu.org id=B28023.150237933617658 (code B ref 28023); Thu, 10 Aug 2017 15:36:01 +0000 Original-Received: (at 28023) by debbugs.gnu.org; 10 Aug 2017 15:35:36 +0000 Original-Received: from localhost ([127.0.0.1]:54644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfpUl-0004ak-QY for submit@debbugs.gnu.org; Thu, 10 Aug 2017 11:35:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfpUj-0004aX-U0 for 28023@debbugs.gnu.org; Thu, 10 Aug 2017 11:35:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfpUb-0003RC-Fb for 28023@debbugs.gnu.org; Thu, 10 Aug 2017 11:35:28 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfpUb-0003R8-CI; Thu, 10 Aug 2017 11:35:25 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3417 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dfpUZ-0001Re-TN; Thu, 10 Aug 2017 11:35:25 -0400 In-reply-to: <704c73b8-54f1-f7ac-821b-6d715a21a8a2@cs.ucla.edu> (message from Paul Eggert on Wed, 9 Aug 2017 16:36:55 -0700) 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:135622 Archived-At: > Cc: 28023@debbugs.gnu.org > From: Paul Eggert > Date: Wed, 9 Aug 2017 16:36:55 -0700 > > Eli Zaretskii wrote: > > Perhaps you are right, and it will "just work". I will have to try > > (for now, I just looked at the sources and the changes, but didn't try > > building). > > It looks to me like it should just work. Well, it's not that easy after all. First, nt/gnulib-cfg.mk needs to be fixed to remove the lines that disable building tempname.c and mkostmp.c, and nt/mingw-cfg.site needs to remove the line which claims that mkostmp is available. Otherwise, tempname.c will not be compiled. This is easy to fix. Then it turns out ms-w32.h only makes its redirections when compiling with -Demacs, which is not what happens when Gnulib sources are compiled. I can fix this, but it will need a few changes in lib-src, which currently doesn't expect 'open' to be redirected. And finally, tempname.c calls mkdir with 2 arguments, whereas mkdir on Windows accepts only one. (This means Gnulib lacks a dependency, since the tempname module should then depend on mkdir, which isn't in lib/.) Since we don't want the Gnulib replacement for mkdir, we will have to change w32.c:sys_mkdir to accept 2 arguments to fix this, unless you have a better idea. How do you propose to proceed with this? > You might also consider the second > attached patch: it removes the MS-Windows implementation of mkostemp, since the > generic code should just work as well. Once the above problems are taken care of, the mkostemp part should be easy. Thanks.