strange behaviour with ssh / stdin
Roumen Petrov
openssh at roumenpetrov.info
Wed Oct 15 19:12:50 EST 2003
Might is linux kernel(?), not ssh(!) problem.
As Laurent show ".../fd/0 -> socket:[27105]", i.e. on linux we have
broken symbolic link - cat ".../fd/0" cannot found
".../fd/socket:[27105]" file.
It is strange that cat without arguments work on linux.
Darren Tucker wrote:
>Damien Miller wrote:
>
>
>>On Mon, 2003-10-13 at 19:56, Laurent Bartholdi wrote:
>>
>>
>>>hi,
>>>i noted the following strange behaviour using ssh and linux. this is
>>>probably a low-priority bug:
>>>
>>># ssh -V
>>>OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
>>># uname -a
>>>Linux funnyfarm 2.4.21-20.1.2024.2.1.nptl #1 Fri Jul 11 06:04:52 EDT 2003 i686 i686 i386 GNU/Linux
>>>
>>># echo Hello | ssh frodo 'cat'
>>>Hello
>>># echo Hello | ssh frodo 'cat /proc/self/fd/0'
>>>cat: /proc/self/fd/0: No such device or address
>>># ssh frodo 'ls -l /proc/self/fd/0'
>>>lrwx------ 1 root root 64 Oct 13 18:51 /proc/self/fd/0 -> socket:[27105]
>>>
>>>
>>This is probably some weird Linux race condition. I can't imagine
>>anything that ssh could do that would cause this.
>>
>>Does /dev/stdin or /dev/fd/0 work? These are often aliases for the same
>>purpose.
>>
>>
>
>On my RH8 box they're all symlinks to the controlling tty if it has one or
>to some kind of socket descriptor if not (as you noted). The problem
>appears to be Linux-specific.
>
>$ uname -sr; ls -l /dev/stdin /dev/fd/0 /proc/self/fd/0
>Linux 2.4.20-20.8
>lrwx------ 1 dtucker dtucker 64 Oct 14 22:06 /dev/fd/0 ->
>/dev/pts/2
>lrwxrwxrwx 1 root root 17 Mar 31 2003 /dev/stdin ->
>../proc/self/fd/0
>lrwx------ 1 dtucker dtucker 64 Oct 14 22:06 /proc/self/fd/0 ->
>/dev/pts/2
>
>In contrast, on Solaris, /dev/fd/0 is a character special device, and your
>example works as expected:
>$ uname -sr; ls -l /dev/fd/0 /dev/stdin
>SunOS 5.8
>crw-rw-rw- 1 root root 247, 0 Oct 14 22:09 /dev/fd/0
>lrwxrwxrwx 1 root root 6 Apr 2 2002 /dev/stdin -> ./fd/0
>$ echo Hello | ssh localhost "cat /dev/fd/0"
>Hello
>
>I remember reading an explanation about this someplace but I don't
>remember the details and I've been unable to locate it again.
>
More information about the openssh-unix-dev
mailing list