octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replace use of mkstemp in makeinfo.m with tmpnam/fopen ?


From: John W. Eaton
Subject: Re: replace use of mkstemp in makeinfo.m with tmpnam/fopen ?
Date: Wed, 18 Feb 2009 00:57:37 -0500

On 17-Feb-2009, Benjamin Lindner wrote:

| John W. Eaton wrote:
| > On 30-Jan-2009, Benjamin Lindner wrote:
| > 
| > | with the current develeopment sources, makeinfo.m utilizes the function 
| > | mkstemp to create its temporary texinfo file.
| > | However, mkstemp is not available on mingw32, so its call returns a file 
| > | descriptor of -1 and subsequently, makeinfo.m fails. This means that 
| > | help() and pring_usage() also fail.
| > | 
| > | Is is acceptable to replace the call to mkstemp() with a call to 
| > | tmpnam() and fopen() instead?
| > | This way, makeinfo.m does not use functions that may not be available on 
| > | some OSes.
| > | 
| > | I have attached a proposal changeset.
| > | This yields working makeinfo.m and thus also help() and print_usage() 
| > | for a mingw32 platform
| > 
| > Would it maybe be better to use a similar method in mkstemp itself so
| > that it can work on systems that don't have the mkstemp library
| > function?  I think we would need a disclaimer in the documentation
| > saying that on systems that don't have the mkstemp library function,
| > Octave's mkstemp does not have the same security properties that
| > mkstemp does.
| > 
| 
| After some research, I found that mingw gcc provides a mkstemps() 
| function in libiberty.a which can be (and is) used as replacement for 
| mkstemp().
| This is also recommended practice according to gnu coding standards.
| 
| I added an autoconf check for the mingw platform and adapted the code in 
| file-io.cc - see the attached changeset.
| 
| Is this an acceptable compromise?
| 
| I'd like to see this fixed for the next release, since it renders the 
| "help" command useless otherwise.

I applied this changeset, but if there is a header file that provides
a declaration for mkstemps, then I think we should search for it and
use it if it is available instead of using

  #if defined (HAVE_MKSTEMPS)
  // Prototype for mkstemps in libiberty
  extern "C" int mkstemps (char *pattern, int suffix_len);
  #endif

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]