You are not alone. I have also seen the 255 (-1) return code once in a
while. Not sure what the frequency is but would guess (2-10%). I never
tracked down the problem.

Another error code problem that is not directly related to ssh is that
some commands do not properly set the exit code so the value cannot be
checked for command success unless you have fully tested the command or
written the code yourself.

A more serious ssh/scp problem is if you use unreliable network
connections is that the process can "hang" on both the client and server
side. Once the circuit has been interrupted, the application using the
link will not complete its data transport and ends up just blocking.  I
don't have enough socket programming experience to know for sure but it
looks like there is no timout of idle connections or an improper shutdown
of the sockets or at least something like that. I have provided
workarounds in my code to kill connections that have existed way beyond
the time that they should have compelted.

dave

 On Wed, 10 Oct 2001, David
Batterham wrote:

>
> Hi OpenSSH users,
>
> I am using openSSH (now 2.9.9p2, but prob occurs in 2.9p2 also) to execute
> commands on a remote machine which outputs data to stdout then pipes it to
> another invocation of ssh which connects back to the first machine in the same
> way, where it starts a program to read and store the output from the command on
> the second machine. I am using the "command" option in the keys file to force
> execution of a particular command when that key is used for authentication.
>
> My problem is this. The remote ssh returns an error code of 255 (using echo $?),
> or (-1 in the debug), despite the command executing successfully. about 5-10% of
> the time it returns 0. In all cases it "appears" the command completed
> successully, and is simply an issue of ssh failing to close the channel cleanly.
> My guess is that one side is closing before the other acknowledges and therefore
> thinks the channel has been prematurely terminated.
>
> My questions are: How sure can I be that I am indeed getting all data from the
> pipe? How can I accurately determine the exit status of the command (ufsdump)
> which is piping data into ssh, regardless of ssh's exit status ? Has anyone else
> seen this problem and/or resolved it ?
>
> If more debug would be helpful, please let me know...
>
> Below is the debug from the remote side when it fails:
>
> <snip>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to