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


View this message in rfc822 format

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




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

Previous Next


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