bug-gnulib
[Top][All Lists]
Advanced

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

Re: fix inadequate Windows implementation of tmpfile


From: Bruno Haible
Subject: Re: fix inadequate Windows implementation of tmpfile
Date: Fri, 16 Feb 2007 04:04:33 +0100
User-agent: KMail/1.5.4

Ben Pfaff wrote:
> I agree that the Windows implementation is, arguably, C99 and
> POSIX compliant.  But I claim that it has an unreasonably poor
> quality of implementation, bad enough that we should replace it.
> If a Unix-like system implemented its tmpfile in a similar way,
> by always attempting to create a file in the root directory and
> failing if permissions were lacking, I imagine that we'd all
> accept that this is a poor implementation that should be
> replaced.
> 
> To me the Microsoft documentation seems like a red herring.  The
> way I've always thought about Gnulib is that it allows a GNU
> program to make assumptions about its environment that GNU
> programmers find comfortable, by covering up the differences
> where it is possible.  For example, GNU programmers find it
> comfortable to assume that malloc(0) returns non-null, so Gnulib
> helps with that.

Paul, what's your opinion on this? Should gnulib includes overrides under
the same function name, even if they contradict the respective platform's
documentation?

> > Can you elaborate, please? clean-temp guarantees that the file will be
> > removed in most cases. You want it removed earlier, as soon as the fclose
> > happens? To save disk space?
> 
> Yes: PSPP uses temporary files for transposing big matrices,
> out-of-core merge sorting, and so on, so it's a good idea to free
> up disk space when it can.

But with the clean-temp module, you can arrange yourself to free the
disk space as soon as possible: just call cleanup_temp_file right after
close_temp. The only feature that _O_TEMPORARY provides is that the file
is removed if the process crashes.

Bruno





reply via email to

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