bug-gnu-pspp
[Top][All Lists]
Advanced

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

PSPP-BUG: [bug #30530] Usage of tmpfile()


From: anonymous
Subject: PSPP-BUG: [bug #30530] Usage of tmpfile()
Date: Fri, 23 Jul 2010 14:46:37 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7 ( .NET CLR 3.5.30729)

URL:
  <http://savannah.gnu.org/bugs/?30530>

                 Summary: Usage of tmpfile()
                 Project: PSPP
            Submitted by: None
            Submitted on: Fr 23 Jul 2010 14:46:36 UTC
                Category: System/Portable File I/O
                Severity: 5 - Average
                  Status: None
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
                  Effort: 0.00

    _______________________________________________________

Details:

Note: I originally posted this bug on bug-gnu-pspp but I got no reply.


The PSPP command line binary may create a few temporary files during data
processing.
As far as I can see, pspp uses the TMPDIR environment variable (it uses
getenv("TMPDIR") and uses the result when available) to determine the
directory for temporary files. That means the directory for temporary files
can be configured at runtime when invoking the pspp binary.
This is fine, however, I think pspp also uses the POSIX tmpfile() call in
some cases. tmpfile() does not seem to use the TMPDIR environment variable and
as far as I can see it is not fully portable nor is its result predictable.

The tmpfile man page says:
"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.".

P_tmpdir is a compile time definition whereas reading an environment variable
is a runtime configuration. 

P_tmpdir defaults to "/tmp" in my enviroment (which is the system's temporary
directory). That means pspp will create a few temporary files in /tmp,
however, it creates several other files in /opt/pdp/tmp (which is the
directory specified using the $TMPDIR environment variable).
That means when invoking pspp from the command line the temporary files may
go to two different directories which is not very good when trying to control,
monitor, and limit disk usage. 

While tmpfile() is definitely convenient to use in the code, I think the
calls should be changed to use some procedure that uses the TMPDIR environment
variable (when available) and creates the temporary files there. Additionally,
the temporary files would need to be removed when not required anymore. 
tmpfile() does that automatically but any other procedures won't.

In pspp-0.6.1, I found the following usages of tmpfile():

src/data/case-tmpfile.c:54:  ctf->file = tmpfile ();
src/libpspp/pool.c:754:  FILE *file = tmpfile ();   
src/output/postscript.c:1096: ch->file = tmpfile ();

I saw there is a more recent version of pspp already, however, the newer
version still uses tmpfile().
Do you think the tmpfile() calls can be changed?





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30530>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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