develooper Front page | perl.perl5.porters | Postings from May 2004

Re: [perl #29883] Closing file seems to cause a seek operation

From:
Alan Burlison
Date:
May 28, 2004 16:11
Subject:
Re: [perl #29883] Closing file seems to cause a seek operation
Message ID:
40B7C730.9050809@sun.com
Nicholas Clark wrote:

>>>I had this hunch that it's because you're using exit() (rather than 
>>
>>_exit()),
>>
>>>and I'd guess that exit is calling fflush(), and that you're hitting the
>>>bug in Solaris that fflush() clobbers input streams.
>>
>>That particular bug was fixed in Solaris 8, AFAIK, this is something 
>>different.

Actually, it appears it wasn't fixed until Solaris 9.

> As this behaviour is replicatable in Solaris 10, it has to be something
> different.

It is, it exactly your hunch - you shouldn't use exit() in a child 
process that doesn't exec, you should use _exit.

>>>(ie something non-conformant with C89. Yes. C EIGHTY nine. Not C99.
>>>Everyone expecting universal C99 conformance any time soon will be
>>>disappointed)
>>
>>The behaviour exhibited is required by SVID.  It's doing what it is 
>>supposed to
>>do.
> 
> I was meaning the fflush(NULL) behaviour, which seems not to be the cause
> here, w.r.t. the C89 comment.
> 
> And I wasn't clear - it wasn't a dig at Solaris in particular. It's more
> a general frustration that the world sucks, and takes {sometime,maybe,never}
> to achieve conformance with standards.

This area of behaviour is very poorly defined, and even appears to 
conflict in the various standards - there was an immense amount of 
legwork expended on trying to decide which behaviour was correct, and 
what happens now doesn't conflict with any of the relevant standards.

-- 
Alan Burlison
--




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About