GNU bug report logs - #15015
Fix some minor races in hosts lacking mkostemp

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 3 Aug 2013 08:29:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 15015 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 15015 <at> debbugs.gnu.org
Subject: Re: bug#15015: Fix some minor races in hosts lacking mkostemp
Date: Sat, 03 Aug 2013 07:40:35 -0700
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.




This bug report was last modified 11 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.