[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error in pipe implementation?

From: Marcus Brinkmann
Subject: Re: error in pipe implementation?
Date: Fri, 20 Jul 2001 14:28:07 +0200
User-agent: Mutt/1.3.18i

On Fri, Jul 20, 2001 at 11:13:20AM +0200, Fabian Sturm wrote:
> But im now sure there is some error in the pipe handling of hurd too.

I think you found a bug.  What you describe is repeated in the C lib info
doc, clear as water.  Raising SIGPIPE on read is definitely bad, if we do
this, we have a bug.

Here are some pointers for your code digging:

glibc/hurd/hurd/fd.h contains the code that converts an error like EPIPE
into a signal.  See hurd_fd_error and the function it calls.

The Hurd pipe handling is in hurd/pflocal in io.c, sock.c and socket.c.
sock_acquire_read_pipe has the following code:

  else if (sock->flags & SOCK_SHUTDOWN_READ)
    /* Reading on a socket with the read-half shutdown always acts as if the
       pipe were at eof, even if the socket isn't connected yet [at least in
       netbsd].  */
    err = EPIPE;

Now, glibc raises SIGPIPE on EPIPE.  Is this the error we return?

In io.c, S_io_read (S_io_readable) we have the following (reps similar) code:

  err = sock_acquire_read_pipe (user->sock, &pipe);
  if (err == EPIPE)
    /* EOF */
      err = 0;
      *data_len = 0;

So an EPIPE is converted into an EOF correctly, and the error value is

In socket.c, S_socket_recv, we have:

  err = sock_acquire_read_pipe (user->sock, &pipe);
  if (err == EPIPE)
    /* EOF */
      *data_len = 0;
      if (num_ports)
        *num_ports = 0;
      if (control_len)
        *control_len = 0;

Here, the error value is not cleared.  However, I think this part of the
code is about unix domain sockets, not pipes (anyway, might be a bug, or
even the bug?).

I could not find other relevant occurances of EPIPE.  Can you debug the
application and involved servers to find out where the EPIPE is coming from?


`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]