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
From:
=?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?=
Date:
July 4, 2013 23:18
Subject:
Re: [perl #57512] Implicit close()s are silently unchecked for error
Message ID:
CA+OH3v1aiiqwxbU4H7rReLxpkEY9Ydqj=Nnh3E8h_m8p7R5hfg@mail.gmail.com
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.

Olga

On Sat, Feb 16, 2013 at 9:55 PM, Tom Christiansen <tchrist@perl.com> 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`\/ }
.----'-/`-/     olga.kryzhanovska@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

Thread Previous | Thread Next


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