Re: Why dup()?

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

 



On 12/10/17 12:54, Clark Wang wrote:
How did you hit the problem? "ssh host echo hello | cat" works fine for me.

That's because ssh exited, not because of EOF.

Consider the following:

   ssh localhost 'exec cat > /dev/null' | { read l; echo ${l:-EOF}; }

One should see "EOF" immediately (for values of immediate that include startup latency), but that's not what happens.

I did have a better example.  When ssh was run with debug output, it showed ssh drain and close output when the remote end closed it's output.  Owing to ssh having two copies of the output descriptor, the downstream program did not see that EOF (it's not EOF until both file descriptors are closed.)  Now, irritatingly, I can't reproduce that.  Now, the remote program closes its output, the sshd parent closes its end of that pipe, but ssh smugly sits there, keeping output (both copies) open until the remote program exits.  Clearly there is more going on that just two descriptors to the same output pipe.

It's wrong; ssh should not absorb EOF.
_______________________________________________
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