pspp-dev
[Top][All Lists]
Advanced

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

Re: temporary files in wine


From: Ben Pfaff
Subject: Re: temporary files in wine
Date: Wed, 14 Feb 2007 09:52:10 -0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

"John McCabe-Dansted" <address@hidden> writes:

> On 2/13/07, Ben Pfaff <address@hidden> wrote:
>> I really think that we can use the gnulib version of mkstemp, but
>> surely someone else has encountered this and can perhaps provide
>> guidance.
>
> Yes. That would probably be better than linking against libiberty
>
>> Another option would be to add a gnulib module for tmpfile that
>> replaces it with a non-broken one.
>
>>From man tmpfile: "The  standard  does not specify the directory that
> tmpfile() will use. Glibc will try the path prefix P_tmpdir defined in
> <stdio.h>, and if that fails the directory /tmp."

The manpage is incorrect.  glibc actually checks TMPDIR before
P_tmpdir.  The glibc manual says this (about the tempnam
function), which is what glibc actually does:

     The directory prefix for the temporary file name is determined by
     testing each of the following in sequence.  The directory must
     exist and be writable.

        * The environment variable `TMPDIR', if it is defined.  For
          security reasons this only happens if the program is not SUID
          or SGID enabled.

        * The DIR argument, if it is not a null pointer.

        * The value of the `P_tmpdir' macro.

        * The directory `/tmp'.

> Ironically, this is not compatible with the GNU coding standard which
> states that you should fisrt check the "TMPDIR" environment variable
> (unless perhaps the suid or sgid bit is set). With the patch at
>  http://lists.gnu.org/archive/html/pspp-dev/2007-02/txtIdtmRJpUxd.txt
> we are on the way to implementing a GNU coding standard compliant
> version of tmpdir(). I suggest that we create a "gnu_tmpfile()"
> function and exclusively call that. Perhaps gnu_tmpfile() should also
> be put in gnulib?

I respectfully disagree that a new function for temporary files
is needed.  FLIP and charts (the current users of tmpfile) should
be able to use tmpfile, for reasonable implementations of
tmpfile.  I think that we should just replace tmpfile with a
reasonable implementation when necessary, which is the approach
that gnulib follows in other cases.  I'll try to come up with a
gnulib module for this.

As for the functions in make-file.c, I'd be happier if
make_temp_file simply became a call to the path_search function
from gnulib, followed by a call to mkstemp.  There's less
duplicated code then.  The make_unique_file_stream function, on
the other hand, needs to just die, because it doesn't make sense
to make the .png files for HTML output in a separate directory
from the HTML files.  We can just name them based on the .html
file's name, in the same directory.
-- 
Ben Pfaff 
address@hidden
http://benpfaff.org




reply via email to

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