[ 
https://issues.apache.org/jira/browse/SSHD-1106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17240996#comment-17240996
 ] 

min yun law commented on SSHD-1106:
-----------------------------------

trace the Mina sshd code, the scp command string is from :

String cmd = ScpClient.createReceiveCommand(remote, Collections.emptyList());

which return something like: "-p -f – remotefilefullpath"

and in AbstractScpClient.java

protected ChannelExec openCommandChannel(ClientSession session, String cmd) 
throws IOException {
 long waitTimeout = session.getLongProperty(SCP_EXEC_CHANNEL_OPEN_TIMEOUT, 
DEFAULT_EXEC_CHANNEL_OPEN_TIMEOUT);
 ChannelExec channel = session.createExecChannel(cmd);

...

 

this channel has problem to parse the scp cmd if the remote filename has 
space(since it is invalid)

so, when call those  ScpClient.upload() and download() API, we have to quote 
the remote file name, but these API has no comment to describe this limitation.

 

> SCP failed for target filename with space inside
> ------------------------------------------------
>
>                 Key: SSHD-1106
>                 URL: https://issues.apache.org/jira/browse/SSHD-1106
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.5.1
>            Reporter: min yun law
>            Priority: Major
>
> when using ScpClient.upload() and download() API and give the remote file 
> name with space inside, it will throw exception as:
> java.io.EOFException: readAck - EOF before ACK
>  
> Here is sample of code:
> String localDir = "/scratch/downloads/";
>  String fileName = "p201300_Linux-x86-64 (1).zip";
>  String remotePath = "/tmp";
> File localPathFile = new File(localDir, fileName);
>  Path pathFile = localPathFile.toPath();
> //remote is linux 
> String remoteFullPath = remotePath+"/"+fileName;
> Collection<ScpClient.Option> options = EnumSet.noneOf(
>  ScpClient.Option.class);
> scpClient.upload(pathFile,remoteFullPath,option); //it will throw exception 
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to