scp return codes are random

From: Sam Robertson (
Date: 11/23/03

  • Next message: Darren Tucker: "Re: scp return codes are random"
    Date: Sat, 22 Nov 2003 21:11:40 -0800

    I'm using openssh-3.7.1p2 on one machine and connecting to a Solaris 9
    system running Sun_SSH_1.0. I'm really not quite sure which version of
    OpenSSH this is or if it's even OpenSSH anymore.

    Anyway, I've tried the following with 3.7p1, 3.5p1, 3.7.1p2 and have
    the same results in all cases.

    Using the following test program

    cmd="/workdir/openssh-3.7.1p2/bin/scp -oProtocol=2 -q -S 
    /workdir/openssh-3.7.1p2/bin/ssh -B /etc/passwd startrek1:/tmp"
    echo "Returned: $?"
    So when I run this in a simple while loop and even ensure that the 
    remote file is removed from /tmp, I get random return codes:
    [startrek2]$ while /bin/true ; do sleep 1 ; 
    /workdir/openssh-3.7.1p2/bin/ssh -2 startrek1 "rm -f /tmp/passwd" ; 
    ./ ; done
    Returned: 1
    Returned: 1
    Returned: 1
    Returned: 0
    Returned: 1
    Returned: 1
    I can't for the life of me figure out why this is happening.  Running 
    scp with -v and diffing a successful run with an unsuccessful run 
    results in:
    [startrek2]$ diff -u bad-result good-result
    --- results     Sat Nov 22 20:00:58 2003
    +++ results2    Sat Nov 22 20:01:06 2003
    @@ -37,6 +37,7 @@
     debug1: Entering interactive session.
     debug1: Sending command: scp -v -t /tmp/passwd
     Sending file modes: C0644 6918 passwd
    +debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
     debug1: channel 0: free: client-session, nchannels 1
     debug1: fd 0 clearing O_NONBLOCK
     debug1: fd 1 clearing O_NONBLOCK
    @@ -43,5 +44,5 @@
     debug1: fd 2 clearing O_NONBLOCK
     debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
     debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
    -debug1: Exit status -1
    -Cmd returned: 256 256
    +debug1: Exit status 0
    +Cmd returned: 0 0
    So is there something I'm missing or is this a client & server mis-match 
    problem?  Additionally, I'm not seeing this under Linux, it seems to 
    manifest itself only with connecting to the default installed SSH client 
    that comes with Solaris 9.

  • Next message: Darren Tucker: "Re: scp return codes are random"