[Haskell-cafe] Re: about openTempFile

Aaron Denney wnoise at ofb.net
Wed Sep 17 18:20:13 EDT 2008

On 2008-09-17, Brandon S. Allbery KF8NH <allbery at ece.cmu.edu> wrote:
> On 2008 Sep 17, at 8:17, Manlio Perillo wrote:
>> The Python tempfile module, as an example, implements a wrapper  
>> around mkstemp function that does exactly this, and the code is  
>> portable; on Windows it uses O_TEMPORARY_FILE flag, on POSIX systems  
>> the file is unlink-ed as soon as it is created (but note that the  
>> code is not signal safe - well, many functions in the Python  
>> standard library are not signal safe).
>> There are reasons why GHC library does not implement this?
> POSIX doesn't guaranteed that open-and-unlink works; HP-UX is a  
> "POSIX" platform on which it doesn't.

Huh.  SuS does indeed allow EBUSY for "The file named by the path
argument cannot be unlinked because it is being used by the system or
another process and the implementation considers this an error."

Did HPUX's behavior change at some point?  This is a standard idiom,
and I don't remember having any trouble with it, but I haven't used
anything earlier than 9.  The manpages for 11 only document being a
mount point as cause for EBUSY.

Aaron Denney

More information about the Haskell-Cafe mailing list