Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#26 Ant SCP hands on finish in 1.30

open
nobody
None
5
2006-11-02
2006-11-02
Anonymous
No

I had ant task with <scp> inside. While using 1.29
version of JSch.jar everything went ok. After upgrading
on 1.30 it hangs when scp task copied last file and
should disconnect from the server.

Discussion

  • Logged In: NO

    In my case it hangs after copying the first file in the set.
    It happened to be about 130KB.

     
  • Logged In: NO

    I've experienced the same Problem as described above.
    I think I've narrowed it down to:

    Class org.aoache.tools.ant.taskdefs.optional.ssh.ScpToMessge.

    Here there is a method called

    private void sendDirectoryToRemote(Directory directory, InputStream in, OutputStream out) throws IOException

    in this method there are 2 "waitForAck(in);" calls - It hangs when the program reaches the second one.
    waitForAck(InputStream in) tries to read form the InputSream (looks like it waits for a server response here and is not getting one, so it waits forever).

    Please fix!

    I've been using Version 1.27 and it worked fine, I switched to 1.30 in order to use hashed known_hosts files.

     
  • Joachim H
    Joachim H
    2007-01-15

    Logged In: YES
    user_id=1692384
    Originator: NO

    This is probably not the best solution, but there is temporary experimental workaround for this problem until either the ant people or jsch developers fix this problem:

    what I did was to take the sources of ant and change a single line in the class:

    Class org.apache.tools.ant.taskdefs.optional.ssh.AbstractSshMessage

    in this class go to the method:

    protected void waitForAck(InputStream in) throws IOException, BuildException { ...

    and change the first line in this method "int b = in.read()" (this is where it hangs!!!) to "int b=0;" - recompile and launch!
    This works fine for me. Of course this is risky and highly experimental as I don't precisely know what happens if the server tries to give a repsonse other that "0".

     
  • Eds
    Eds
    2007-11-02

    Logged In: YES
    user_id=1841283
    Originator: NO

    I received a similar problem. I have tested with 1.29 through 1.36 and only 1.29 works. I am using ant version 1.7.0. Below is a simple build file that will help you to reproduce the problem. It will consistently hang on the same file (for me) "package-tree.html". It is also worthy to note that in version 1.29, it pauses on this file (multiple times - exists in multiple directories). I have only been able to reproduce this problem when scp'ing multiple level directories. To run this, create a file build.xml with the content at the bottom. Place this file in the bin directory of ant. goto the command prompt and type ant (assuming you have ant in your path, etc.). You can place this build file where ever you like, you will just have to change the fileset values. Also, please update the todir to match your own settings. I believe that is comprehensive enough. Oh, yea, tested on win2k, and winxp (if it matters) and once connecting to sourceforge.net.

    <project name="test" default="testIt" basedir=".">
    <target name="testIt">
    <scp todir="myId:mypswd@abc.com:/home/wherever/temp/." verbose="true" trust="true">
    <fileset dir="../docs/manual/api/">
    </fileset>
    </scp>
    </target>
    </project>