New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module-ssh2: SFTPClient::transferFile() corrupts the file on destination #2633

Closed
tehe opened this Issue Jan 30, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@tehe

tehe commented Jan 30, 2018

The method returns -1, but no exception is thrown.

Speculation: This only happens to files that are larger than QSSH2_BUFSIZE.

FWIW, I used the following code for reproduction:

#!/bin/env qore
%new-style
%requires ssh2

sub main() {

    printf("%N\n", ARGV);

    SFTPClient sftp(ARGV[0]);
    sftp.setKeys(ARGV[1]);

    int size = sftp.transferFile(ARGV[2], ARGV[3] + "/file.xml");   # XXX: File ends up corrupted on destination
    # int size = sftp.putFile(ReadOnlyFile::readTextFile(ARGV[2]), ARGV[3] + "/file.xml"); # Note: This one works
    printf("transferFile = %d\n", size);
}

main();

@davidnich davidnich added this to the 0.8.13.3 milestone Jan 30, 2018

@davidnich

This comment has been minimized.

Contributor

davidnich commented Jan 30, 2018

@tehe thank you for reporting this - I found the cause and will have the fix packaged up tomorrow

davidnich added a commit to qorelanguage/module-ssh2 that referenced this issue Jan 30, 2018

pvanek added a commit to qorelanguage/module-ssh2 that referenced this issue Jan 31, 2018

Bugfix/2633 sftp fix (#69)
* refs #2633 initial SFTP streaming write fix

* refs qorelanguage/qore#2633 fixed SFTPClient streaming bugs, added tests

davidnich added a commit to qorelanguage/module-ssh2 that referenced this issue Feb 1, 2018

@davidnich davidnich added the fixed label Feb 2, 2018

@davidnich davidnich closed this Feb 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment