of "Thu, 11 Nov 2010 01: 08:02 +0100." 
<aanlktiky36yaudqj2=2rdrpksrxkoubpjnmhuxykd...@mail.gmail.com>
References: <18061.1289240...@chthon> 
<20101109060255.9378.qm...@lists-nntp.develooper.com> <21672.1289313...@chthon> 
<demer...@gmail.com> 
<aanlktimn_hrtznemh2zqxnarq9v1onx5qef-9hzom...@mail.gmail.com> 
<29825.1289316...@chthon> <faw...@gmail.com> 
<aanlktikxy3qybzp+mybjshosexslcoz7js-xu6phl...@mail.gmail.com> 
<9570.1289357...@chthon> 
<aanlktinii_exqoirnq53rul1ubobw36ddvuxb1ovt...@mail.gmail.com> <tchr...@chthon> 
<25267.1289362...@chthon> <9217.1289400...@chthon> 
<aanlktiky36yaudqj2=2rdrpksrxkoubpjnmhuxykd...@mail.gmail.com>
Mime-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8
X-Mailer: nmh v1.3 && nvi v1.79 (duh!)
Date: Wed, 10 Nov 2010 17:50:52 -0700
Message-ID: <32724.1289436...@chthon>
From: Tom Christiansen <tchr...@chthon>

> 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.

============

    CLOSE(2)          Linux Programmer’s Manual             CLOSE(2)

    ERRORS
       EBADF  fd isn’t a valid open file descriptor.
       EINTR  The close() call was interrupted by a signal; see signal(7).
       EIO    An I/O error occurred.

============

    SunOS 5.10          Last change: 18 Oct 2005                    2
    System Calls                                             close(2)

    ERRORS

      The close() function will fail if:

         EBADF           The fildes argument  is  not  a  valid  file
                         descriptor.
         EINTR           The close() function was  interrupted  by  a
                         signal.
         ENOLINK         The fildes argument is on a  remote  machine
                         and  the  link  to that machine is no longer
                         active.
         ENOSPC          There was no free  space  remaining  on  the
                         device containing the file.

      The close() function may fail if:

         EIO             An I/O error occurred while reading from or
                         writing to the file system.

============

Other manpages say that lingering EIO errors from a previous read(2) 
and/or write(2) can cause close(2) to do the same.  You can kinda 
read that in the last EIO description above, if you squint enough.

Here's another problem:

    while (<STDIN>) {
        ...
    }
    exit(0);

Nobody *EVER* bothers to check that when readline returned undef it did so
*without setting errno*.  A program run via

    perl script < /bad/disk/file

can get EIO and nobody ever notices.   Bad.  Very bad.  Very very bad.

This kinda thing needs to be autodied or autocarped.  It's too important
either to miss or to expect everybody to always do right.

We should help people.  It's like the while(<>) getting a defined().

--tom

Reply via email to