Bug 341 - Return Code unpredictable
Summary: Return Code unpredictable
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: -current
Hardware: Other AIX
: P3 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
: 587 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-09 00:53 AEST by Norbert Weuster
Modified: 2004-04-14 12:24 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Norbert Weuster 2002-07-09 00:53:47 AEST
hello, 

I try to use ssh in a script (ttt.ksh) like this:
#!/bin/ksh
ssh <hostname> date
echo $?

if I start ttt.ksh, it will always work and return 0.
if I start ttt.ksh without a tty, e.g. "echo ttt.ksh|at now",
it will always work, but the return code will be unpredictable 255 or 0.

any hints or solutions?

best regards
 Norbert Weuster
Comment 1 Norbert Weuster 2002-07-09 15:44:40 AEST
the optinal Flags -n and/or -T doesn't change the situation
Comment 2 Norbert Weuster 2002-07-16 22:48:48 AEST
after creating user "sshd" and/or a reboot,
the problem couldn't be reproduced.

best regards
 Norbert Weuster
Comment 3 Norbert Weuster 2002-07-31 17:13:39 AEST
can reproduce situation again.
problem still exists
Comment 4 John Osell 2002-09-24 09:39:42 AEST
I have the same problem. The script as follows is run from cron:

 while [ 1 ]
 do
   ssh <hostname> date
   echo $?
 done

The script returns 255 anywhere from 2-20% of the time when run from cron and
works perfectly fine when run from the command line.

I am running the test on AIX 4.3.3.0 and OpenSSH_2.9p1, SSH protocols 1.5/2.0,
OpenSSL 0x0090581f

John O.
Comment 5 Damien Miller 2003-01-07 18:26:50 AEDT
Please verify that this is still the case with 3.5p1 (2.9 is ooold)
Comment 6 John Osell 2003-01-08 04:35:11 AEDT
It appears to be fixed with the latest versions, I've tested this with
OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090605f
Comment 7 Norbert Weuster 2003-01-09 22:05:20 AEDT
IBM provides the "aix toolbox for linux apps" only with the versions
openssh-3.4p1-5.aix4.3.ppc.rpm          openssh-server-3.4p1-5.aix4.3.ppc.rpm
openssh-clients-3.4p1-5.aix4.3.ppc.rpm  openssl-0.9.6e-2.aix4.3.ppc.rpm

so I tested these versions and I cannot reproduce the bug again.

best regards
  Norbert Weuster
Comment 8 Alexander GQ Gerasiov 2003-02-27 05:42:48 AEDT
I have the same problem with  OpenSSH_3.5p1 Debian 1:3.5p1-4, SSH protocols 1.5/2.0, OpenSSL 0x0090701f when I'm trying connect to non-exist host from the shell it returns 0 on one pc and 1 on another one. But when I do it on the first pc from the script it returns 1. Anyway it looking strange. 
Comment 9 Damien Miller 2003-02-27 11:20:32 AEDT
It is certainly fixed in -current:

[djm@xenon djm]$ for x in 1 2 3 4 5 6 7 8 9 10 ; do ssh djm@localhost exit $x ;
echo $? ; done
1
2
3
4
5
6
7
8
9
10

It is also in the regress tests. 
Comment 10 John Canger 2003-06-13 00:54:34 AEST
*** Bug 587 has been marked as a duplicate of this bug. ***
Comment 11 Damien Miller 2004-04-14 12:24:18 AEST
Mass change of RESOLVED bugs to CLOSED