Inconsistent status from OpenSSH with redirected input

This is a discussion on Inconsistent status from OpenSSH with redirected input within the SSH forums, part of the Protocols category; I first saw this on an OpenSSH 4.2 installation, so we pulled down 5.1p1 and see the same thing. On linux hosts, the status will be 255 sometimes if it ...

Go Back   Unix Linux Forum > Technologies & Tools > Protocols > SSH

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 03:33 PM
Default Inconsistent status from OpenSSH with redirected input

I first saw this on an OpenSSH 4.2 installation, so we pulled down 5.1p1
and see the same thing. On linux hosts, the status will be 255
sometimes if it has stdin redirected to /dev/null. But only the status
is wrong. The connection is working and all the data comes back.

$ /usr/local/bin/ssh testg5 perl -v < /dev/null > /dev/null ; echo $?
0
$ /usr/local/bin/ssh testg5 perl -v < /dev/null > /dev/null ; echo $?
255
$ /usr/local/bin/ssh testg5 perl -v < /dev/null > /dev/null ; echo $?
0
$ /usr/local/bin/ssh testg5 perl -v < /dev/null > /dev/null ; echo $?
255
$ /usr/local/bin/ssh testg5 perl -v < /dev/null > /dev/null ; echo $?
255

Just on a lark I tried adding '-n' to the ssh line. It didn't make any
difference. If I don't redirect STDIN, then I get status 0 every
single time.

This is causing an automated testing framework to think that the ssh
connection has failed, when it's just fine.

If I capture a -vvv output from a "good" and "failed" connection,
there's very little difference.

diff /tmp/ssherr*
41a42
> debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

48c49
< debug1: Exit status -1
---
> debug1: Exit status 0


Any ideas about what is happening here or more usefully, how I can fix
this? The framework I have will always redirect STDIN. I can't rewrite
it to avoid that bit.

Thanks for any help!!

--
Darren
Reply With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 11:11 PM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger