[jira] [Commented] (SSHD-970) transferTo function of SftpRemotePathChannel will loop if count parameter is greater than file size

2020-02-27 Thread Michele Milesi (Jira)


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

Michele Milesi commented on SSHD-970:
-

[~lgoldstein] you are right, on the source code the line is 358 but on MR was 
262.

May be that in MR we see the line number of the commit diff.

> transferTo function of SftpRemotePathChannel will loop if count parameter is 
> greater than file size
> ---
>
> Key: SSHD-970
> URL: https://issues.apache.org/jira/browse/SSHD-970
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.4.1
>Reporter: Michele Milesi
>Assignee: Guillaume Nodet
>Priority: Major
>  Labels: patch
> Fix For: 2.4.1
>
> Attachments: SftpRemotePathChannel.patch
>
>
> The method {{transferTo}} of {{SftpRemotePathChannel}} does not checks 
> {{eof}} condition.
>  * The exit condition from the reading loop is that totalRead variable is not 
> less than count parameter.
>  * At eof the value the method does not increment the totalRead variable
>  * If {{count}} parameter value is greater than source file size the value of 
> {{totalRead}} will never reach the {{count}} value
> In order to exit from the loop we need to check the eof condition.
> The attached patch contains:
>  * A junit test (added to SftpRemotePathChannelTest.java)
>  * A simple fix to the exit condition
> The problem was found on:
>  * 2.4.0 released version
>  * current git head



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

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-970) transferTo function of SftpRemotePathChannel will loop if count parameter is greater than file size

2020-02-27 Thread Michele Milesi (Jira)


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

Michele Milesi commented on SSHD-970:
-

I was lucky, I'm doing a JUnit integration test and I've found it.

BTW the workaround, using the file size as count, works better than my code 
with a fixed buffer size.

 

Thanks for your work.

> transferTo function of SftpRemotePathChannel will loop if count parameter is 
> greater than file size
> ---
>
> Key: SSHD-970
> URL: https://issues.apache.org/jira/browse/SSHD-970
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.4.1
>Reporter: Michele Milesi
>Assignee: Guillaume Nodet
>Priority: Major
>  Labels: patch
> Fix For: 2.4.1
>
> Attachments: SftpRemotePathChannel.patch
>
>
> The method {{transferTo}} of {{SftpRemotePathChannel}} does not checks 
> {{eof}} condition.
>  * The exit condition from the reading loop is that totalRead variable is not 
> less than count parameter.
>  * At eof the value the method does not increment the totalRead variable
>  * If {{count}} parameter value is greater than source file size the value of 
> {{totalRead}} will never reach the {{count}} value
> In order to exit from the loop we need to check the eof condition.
> The attached patch contains:
>  * A junit test (added to SftpRemotePathChannelTest.java)
>  * A simple fix to the exit condition
> The problem was found on:
>  * 2.4.0 released version
>  * current git head



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

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-970) transferTo function of SftpRemotePathChannel will loop if count parameter is greater than file size

2020-02-27 Thread Lyor Goldstein (Jira)


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

Lyor Goldstein commented on SSHD-970:
-

Yes - I believe you are right - good catch...

> transferTo function of SftpRemotePathChannel will loop if count parameter is 
> greater than file size
> ---
>
> Key: SSHD-970
> URL: https://issues.apache.org/jira/browse/SSHD-970
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.4.1
>Reporter: Michele Milesi
>Assignee: Guillaume Nodet
>Priority: Major
>  Labels: patch
> Fix For: 2.4.1
>
> Attachments: SftpRemotePathChannel.patch
>
>
> The method {{transferTo}} of {{SftpRemotePathChannel}} does not checks 
> {{eof}} condition.
>  * The exit condition from the reading loop is that totalRead variable is not 
> less than count parameter.
>  * At eof the value the method does not increment the totalRead variable
>  * If {{count}} parameter value is greater than source file size the value of 
> {{totalRead}} will never reach the {{count}} value
> In order to exit from the loop we need to check the eof condition.
> The attached patch contains:
>  * A junit test (added to SftpRemotePathChannelTest.java)
>  * A simple fix to the exit condition
> The problem was found on:
>  * 2.4.0 released version
>  * current git head



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

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



[jira] [Commented] (SSHD-970) transferTo function of SftpRemotePathChannel will loop if count parameter is greater than file size

2020-02-27 Thread Michele Milesi (Jira)


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

Michele Milesi commented on SSHD-970:
-

Hi [~lgoldstein] ,

I've checked the MR #111 and it does not fix the problem.

The issue is with the test at line 262 

{{   while (totalRead < count) {}}

That must be like

{{   while (totalRead < count && !eof) {}}

> transferTo function of SftpRemotePathChannel will loop if count parameter is 
> greater than file size
> ---
>
> Key: SSHD-970
> URL: https://issues.apache.org/jira/browse/SSHD-970
> Project: MINA SSHD
>  Issue Type: Bug
>Affects Versions: 2.4.1
>Reporter: Michele Milesi
>Assignee: Lyor Goldstein
>Priority: Major
>  Labels: patch
> Fix For: 2.4.1
>
> Attachments: SftpRemotePathChannel.patch
>
>
> The method {{transferTo}} of {{SftpRemotePathChannel}} does not checks 
> {{eof}} condition.
>  * The exit condition from the reading loop is that totalRead variable is not 
> less than count parameter.
>  * At eof the value the method does not increment the totalRead variable
>  * If {{count}} parameter value is greater than source file size the value of 
> {{totalRead}} will never reach the {{count}} value
> In order to exit from the loop we need to check the eof condition.
> The attached patch contains:
>  * A junit test (added to SftpRemotePathChannelTest.java)
>  * A simple fix to the exit condition
> The problem was found on:
>  * 2.4.0 released version
>  * current git head



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

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org