From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#15015: Fix some minor races in hosts lacking mkostemp Date: Sat, 03 Aug 2013 17:55:19 +0300 Message-ID: <83d2puygbs.fsf@gnu.org> References: <51FCB3D5.7070704@cs.ucla.edu> <83mwozxj84.fsf@gnu.org> <83k3k3xi36.fsf@gnu.org> <51FD1663.6040501@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1375542354 14161 80.91.229.3 (3 Aug 2013 15:05:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Aug 2013 15:05:54 +0000 (UTC) Cc: 15015@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 17:05:56 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V5dFp-0001fa-DI for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 16:56:25 +0200 Original-Received: from localhost ([::1]:58172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5dFp-0004qv-4D for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 10:56:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5dFX-0004Tl-KI for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:56:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5dFS-0007jF-ME for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:56:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5dFS-0007j7-KD for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V5dFS-0000xX-6l for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:56: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: Sat, 03 Aug 2013 14:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15015 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 15015-submit@debbugs.gnu.org id=B15015.13755417273575 (code B ref 15015); Sat, 03 Aug 2013 14:56:02 +0000 Original-Received: (at 15015) by debbugs.gnu.org; 3 Aug 2013 14:55:27 +0000 Original-Received: from localhost ([127.0.0.1]:38313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V5dEt-0000va-93 for submit@debbugs.gnu.org; Sat, 03 Aug 2013 10:55:27 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:57830) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V5dEp-0000vG-45 for 15015@debbugs.gnu.org; Sat, 03 Aug 2013 10:55:25 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MQY00L00MN6DJ00@a-mtaout21.012.net.il> for 15015@debbugs.gnu.org; Sat, 03 Aug 2013 17:55:16 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MQY00LQXMS4BS30@a-mtaout21.012.net.il>; Sat, 03 Aug 2013 17:55:16 +0300 (IDT) In-reply-to: <51FD1663.6040501@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76933 Archived-At: > Date: Sat, 03 Aug 2013 07:40:35 -0700 > From: Paul Eggert > CC: 15015@debbugs.gnu.org > > On 08/03/2013 01:38 AM, Eli Zaretskii wrote: > > > the gnulib mkostemp module ... relies on quite a few functions that are > > redefined in Emacs, and I have no idea what will this do to the gnulib > > implementation. > > I don't see the problem; could you please explain further? > On Microsoft platforms, the only functions that the mkostemp > module should use should be getenv, strlen, memcmp, > gettimeofday, open (..., O_RDWR | O_CREAT | O_EXCL, S_IRUSR > | S_IWUSR), and lstat, and this sort of thing is already > working elsewhere. gettimeofday, open, and lstat are implemented by Emacs in w32.c. At lest the last 2 are not equivalent to what gnulib uses. > > Also, since we still didn't remove the support for > > MS-Windows builds that use nt/configure.bat and the makefile-w32.in > > files, the uses of mktemp in the Emacs sources should be left alone > > for now, if we go this route. > > Presumably nt/configure.bat and makefile-w32.in could be updated > to compile the new files. This sort of thing should be routine, > if that avenue is still supported. This "support" needs volunteers, which didn't yet show up. But if there are two alternatives to fix a problem, and one of them breaks this "support" while the other doesn't, I'd prefer the latter. > > I thought of a far easier solution: use the same code as sys_mktemp > > does, but use 'open' or '_sopen' instead of faccessat. > > This won't suffice for POSIXish platforms that lack mkostemp > but have 'open' with O_EXCL. Solaris is one example. The > Gnulib mkostemp module fixes the races on those platforms. That's OK. We can always install the gnulib stuff for those other platforms, and work around it on Windows.