ssh client is setting O_NONBLOCK on a pipe shared with other processes

Doug Graham edougra at gmail.com
Mon Sep 16 13:41:21 AEST 2019


> So the make process gets an EAGAIN on the write syscall and doesn't
> retry?  That sounds like a bug in whatever make you're using, since
> that could potentially occur in other circumstances too.

What other circumstances?  EAGAIN means that something put the
device into non-blocking mode, and normally, that should only happen
if the program calling write had itself previously set O_NONBLOCK.  I don't
think programs that don't set O_NONBLOCK are required to handle
EAGAIN or short counts.  They *may* need to deal with EINTR but signals
don't come out of nowhere either and many programs run in an environment
where EINTR is also unexpected.

We are using GNU make 3.81 but newer versions of gmake do the same thing:

void
close_stdout (void)
{
  int prev_fail = ferror (stdout);
  int fclose_fail = fclose (stdout);

  if (prev_fail || fclose_fail)
    {
      if (fclose_fail)
        error (NILF, _("write error: %s"), strerror (errno));
      else
        error (NILF, _("write error"));
      exit (EXIT_FAILURE);
    }
}


On Sun, Sep 15, 2019 at 11:16 PM Darren Tucker <dtucker at dtucker.net> wrote:
>
> On Mon, 16 Sep 2019 at 01:18, Doug Graham <edougra at gmail.com> wrote:
> [...]
> > Make occasionally gets an unexpected EAGAIN error and fails the build
> > with the error message "make: write error".
>
> So the make process gets an EAGAIN on the write syscall and doesn't
> retry?  That sounds like a bug in whatever make you're using, since
> that could potentially occur in other circumstances too.
>
> (Same goes for EWOULDBLOCK, as well as EINTR if you don't have
> restartable syscalls).
>
> --
> Darren Tucker (dtucker at dtucker.net)
> GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
>     Good judgement comes with experience. Unfortunately, the experience
> usually comes from bad judgement.


More information about the openssh-unix-dev mailing list