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

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

 



> On 16 Sep 2019, at 16:06, Doug Graham <edougra@xxxxxxxxx> wrote:
> 
>> Case in point; EAGAIN can come if you give your fd to another process
>> and continue using it yourself.
> 
>> Short counts; It is documented behavior that read() and write() may
>> return short counts. It is not documented why, so you can not make
>> any assumptions.
> 
> You might be right about short counts but if you're right about
> EAGAIN, there are
> bugs everywhere.  My first attempt at working around my "make: write error"
> failure was to pipe make into cat or tee, eg: "make | tee make.log".  But that
> caused both cat and tee to fail with EAGAIN.  So they have the same "bug" as
> make.  Also note that make is just calling printf normally and then
> just before exiting,
> it calls ferror(stdout) to see if any error occurred when it
> previously wrote to stdout.
> ferror()  is returning true.  So now the bug has moved into the C library.

Dumb question: shouldn't whatever is calling fork() (here 'make' I believe)
be dup()'ing the FDs just in case the called program does something odd
with them like set O_NONBLOCK? That's what I've always done before
fork(), and I believe what the venerable Mr Stevens recommends.

-- 
Alex Bligh




_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



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

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux