pyscripter/Ssh-Pascal

TScp.Send assign allways 0 to mtime parameter of libssh2_scp_send64

virgoparna opened this issue · 2 comments

In TScp.Send 0 is allways assigned to libssh2_scp_send64 call for mtime parameter.

  Channel := libssh2_scp_send64(FSession.Addr,
    M.AsAnsi(RemoteFile, FSession.CodePage).ToPointer,
    Integer(Word(Permissions)), Stream.Size, IfThen(MTime = 0, DateTimeToUnix(MTime)),
    IfThen(ATime = 0, 0, DateTimeToUnix(ATime)));

IfThen(MTime = 0, DateTimeToUnix(MTime))
should be
IfThen(MTime = 0, 0, DateTimeToUnix(MTime))

In practice it does not make much difference, because libssh2_scp_send64 itself has problems with mtime. Found following post: https://www.libssh2.org/mail/libssh2-devel-archive-2013-04/0038.shtml
Following it I was able to make scp work with mtime when copying small file (~ 5KiB), but it still fails with 655 KiB file. And libssh2 examples about scp are without mtime (and are actually using old libssh2_scp_send function).
libssh2/libssh2#482 is actually about this, but is stale and closed.

Fixed the immediate issue. I am not sure what I can do for the libssh2 underlying issue.

Fixed the immediate issue. I am not sure what I can do for the libssh2 underlying issue.

There is nothing, that can be done. I added this information just in case, if someone should test it and discover, that setting mtime still does not work.