develooper Front page | perl.perl5.porters | Postings from July 2013

Re: [perl #57512] Implicit close()s are silently unchecked for error

Thread Previous | Thread Next
July 4, 2013 23:18
Re: [perl #57512] Implicit close()s are silently unchecked for error
Message ID:
EINTR on close() can happen easily. The ksh93 developers learned that
the hard way (and fixed it for ksh93 version 'u') that busy scripts
may leak file descriptors, if they wiggle a lot with fds.
SA_RESTART is only of little help, as for example Solaris had bugs in
the restart code on NFS file systems, prior to Solaris 11. Other
Unix/Linux variants had similar issues. Granted, the work around is to
require a recent OS patch set, but now that Oracle charges top money
for such patches the fixes may not be wide spread.


On Sat, Feb 16, 2013 at 9:55 PM, Tom Christiansen <> wrote:
>> As Lukas Mai already wrote for read-only filehandles. What
>> should go wrong when closing these?
> If the close does not reflect the error status on the handle, or if that
> error status is wrong, then that doesn't leave much besides the failure of
> the pipe close.  In theory, there is EINTR, although I'm not quite sure how
> that would happen.
>> Also I never understood why open/print/close doesn't throw an exception
>> instead of setting some weird variable, which isn't cleared if the
>> operation was successful.
> It's because Perl just mirrors errno.  Yeah, it's annoying.  That's why
> I was hoping for something better out of the error status.
> --tom

      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/   \-`\-'----.
 `'-..-| /     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About