On Wed, Nov 10, 2010 at 3:53 PM, Tom Christiansen <tchr...@perl.com> wrote:
> However, streams are set up so that their error flag gets set on any
> failed I/O operation, and this sticky flag carries through until the
> ultimate close, whose return reflects that.

I think PerlIO is currently not checking the ferror bit on close/flush
for read-only handles, it's surprisingly non-trivial to properly test
though. I don't know if this behavior is by accident or on purpose.

>> Even close(2) itself can fail, including through EINTR or once
>> again, through EIO [from] a previously uncommitted write(2)
>> having its own trouble.

PerlIO will handle EINTR actually, at least for read, write and close.
open doesn't though.

> One key point here is that even if you pretend nothing else matters--
> utterly foolish though that would be--the pesky EIO is *always* a
> possibility of ruining your day.  Bad disk, anybody?  *That* never
> happens, eh? :(

I still have a hard time imagining how closing a read-only filehandle
can cause EIOs, but I believe you if you say they happen. I've heard
weirder things.

> So Leon, are you "enlightened"?   Still think you can *ever* safely
> ignore close errors, even on files "merely" opened O_RDONLY? :)

For most trivial programs I still wouldn't bother too much about it,
though you are right it's important for anything serious.

Leon

Reply via email to