From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#15015: Fix some minor races in hosts lacking mkostemp Date: Sat, 03 Aug 2013 07:40:35 -0700 Organization: UCLA Computer Science Department Message-ID: <51FD1663.6040501@cs.ucla.edu> References: <51FCB3D5.7070704@cs.ucla.edu> <83mwozxj84.fsf@gnu.org> <83k3k3xi36.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1375541157 4024 80.91.229.3 (3 Aug 2013 14:45:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Aug 2013 14:45:57 +0000 (UTC) Cc: 15015@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 16:45:58 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 1V5d1G-0005fc-Gu for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 16:41:22 +0200 Original-Received: from localhost ([::1]:56564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5d1F-0001qs-OW for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 10:41:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5d15-0001pq-Kp for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:41:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5d0z-0002P7-1P for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:41:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5d0y-0002P2-V8 for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:41:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V5d0y-0000F0-2n for bug-gnu-emacs@gnu.org; Sat, 03 Aug 2013 10:41:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2013 14:41:03 +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.1375540857902 (code B ref 15015); Sat, 03 Aug 2013 14:41:03 +0000 Original-Received: (at 15015) by debbugs.gnu.org; 3 Aug 2013 14:40:57 +0000 Original-Received: from localhost ([127.0.0.1]:38301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V5d0q-0000ET-09 for submit@debbugs.gnu.org; Sat, 03 Aug 2013 10:40:56 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:41390) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V5d0f-0000DR-UJ for 15015@debbugs.gnu.org; Sat, 03 Aug 2013 10:40:49 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 90C2EA6002F; Sat, 3 Aug 2013 07:40:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QgXKsPWKPVWh; Sat, 3 Aug 2013 07:40:35 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-71-108-49-126.lsanca.fios.verizon.net [71.108.49.126]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 844A239E810F; Sat, 3 Aug 2013 07:40:35 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: <83k3k3xi36.fsf@gnu.org> X-Enigmail-Version: 1.5.2 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:76932 Archived-At: 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. mkostemp calls mkdir but that call is never used by Emacs so as long as it compiles we should be OK. > 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. > 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. > alternatively, we could add an implementation of 'mkostemp' > in msdos.c. Sure, that should work fine. The MS-DOS port need not compile the new lib/*.c files.