[Top][All Lists]

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

Re: [bug-gnulib] bug in gl_FUNC_MKSTEMP

From: Jim Meyering
Subject: Re: [bug-gnulib] bug in gl_FUNC_MKSTEMP
Date: Mon, 20 Dec 2004 16:25:04 +0100

Stepan Kasal <address@hidden> wrote:
> 1) gl_FUNC_MKSTEMP in m4/mkstemp.m4 should clean up the temporary files.
> Would the patch attached to this mail be OK?

IMHO, autoconf test programs needn't (and shouldn't) clean
up explicitly.  configure handles it for us, and does a better
job, in that it cleans up even upon e.g., interrupt.
I made an exception in the code for the getcwd-path-max
test because leaving behind a deep hierarchy might cause
trouble for less-robust programs.

> 2) Why does the template use the long prefix "conftest"?

To take advantage of the automatic cleanup-on-trap
code that removes conftest*.

> Shouldn't we use
> 2-4 letter prefix, as suggested in the comment to the source to AS_TMPDIR
> in autoconf/lib/m4sugar/m4sh.m4 ?

No.  Using such a short prefix in a user/project directory impinges on
the available file name space.  Even with the additional .tmp suffix,
co??????.tmp might well expand to the name of a file the user does not
want to lose.

In many GNU projects, you will find that little time has been spent
trying to accommodate archaic 8.3 file name limitations.  Is this
macro actually useful on such systems?  I.e., does djgpp have the
mkstemp bug that this test detects?

In any case, now that it's causing trouble for at least
one other project, I'll address it.  How about this?

2004-12-20  Jim Meyering  <address@hidden>

        * mkstemp.m4: Rather than using "conftestXXXXXX" as the mkstemp
        template, use a temporary directory and an 8.3-friendly template
        to avoid trouble on systems like DJGPP.
        Reported by Juan M. Guerrero via Stepan Kasal.

--- mkstemp.m4.~1~      2004-04-20 05:19:52.000000000 -0400
+++ mkstemp.m4  2004-12-20 09:54:35.000000000 -0500
@@ -15,6 +15,8 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
     AC_CACHE_CHECK([for mkstemp limitations],
+        mkdir conftest.mkstemp
+        cd conftest.mkstemp
 #         include <stdlib.h>
          int main ()
@@ -22,7 +24,7 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
            int i;
            for (i = 0; i < 70; i++)
-               char template[] = "conftestXXXXXX";
+               char template[] = "coXXXXXX.tmp";
                int fd = mkstemp (template);
                if (fd == -1)
                  exit (1);

reply via email to

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