Bug 77365 - Ant scp task not working with openssh-3.9
Bug#: 77365 Product:  Gentoo Linux Version: unspecified Platform: x86
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: java@gentoo.org Reported By: olivier.van.acker@bbc.co.uk
Component: Applications
URL: 
Summary: Ant scp task not working with openssh-3.9
Keywords:  
Status Whiteboard: 
Opened: 2005-01-10 05:37 0000
Description:   Opened: 2005-01-10 05:37 0000
Ant scp task is not working with openssh-3.9 
As soon as ant wants to transfer a directory the following error occurs:

[scp] SSH_MSG_DISCONNECT: 2 Received ieof for nonexistent channel 0.
BUILD FAILED
...
server indicated an error: scp: protocol error: received directory without -r

If I downgrade my sshd to 3.8 everything works fine.
So this error is probably caused by changes in the implementation of scp protocol since openssh-3.9

I als found a patch which adds the -r option to the ant scp task 

Reproducible: Always
Steps to Reproduce:
1.Do an scp task in an ant build file with a <fileset dir=".." /> in it
2.Have openssh-3.9 runnig
3. ant this build.xml
Actual Results:  
Error:
[scp] SSH_MSG_DISCONNECT: 2 Received ieof for nonexistent channel 0.
BUILD FAILED
...
server indicated an error: scp: protocol error: received directory without -r

Expected Results:  
Copy all files and directories to remote server

This error is probably caused by changes in the implementation of scp protocol
since openssh-3.9

I als found a patch which adds the -r option to the ant scp task on:
http://sourceforge.net/mailarchive/forum.php?thread_id=6173225&forum_id=12628

 diff -Naur
apache-ant-1.6.2/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java
apache-ant-1.6.2.new/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java

--apache-ant-1.6.2/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java
Fri
Jul 16 00:57:40 2004
 +++
apache-ant-1.6.2.new/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java
Sat
Dec 18 05:51:39 2004
 @@ -112,7 +112,7 @@
      }
  
      private void doMultipleTransfer() throws IOException, JSchException {
 -        Channel channel = openExecChannel("scp -d -t " + remotePath);
 +        Channel channel = openExecChannel("scp -r -d -t " + remotePath);
          try {
              OutputStream out = channel.getOutputStream();
              InputStream in = channel.getInputStream();


Cheers,


Olivier

------- Comment #1 From Thomas Matthijs (RETIRED) 2005-01-10 05:44:27 0000 -------
upstream  as
http://issues.apache.org/bugzilla/show_bug.cgi?id=31939

------- Comment #2 From Jan Brinkmann (RETIRED) 2005-02-03 13:10:51 0000 -------
patch added to ant-core and ant-tasks, commited. thanks for the report