-
Notifications
You must be signed in to change notification settings - Fork 152
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
SCP receive file size error on windows. #109
Comments
It confuse me a lot why |
This may be a case where If you can checkout the repository and run |
Unfortunately, it does not.
It does compile just fine on Windows 10, however the issue remains. |
I am also seeing the same issue. |
On 64 bit build it is returning the timestamp. But on 32 bit build, it is returning an even bigger number. For a file of size 40960 bytes, I am getting the following sizes depending on the target architecture. 64 Bit - 1563919174 |
The issue happens when I found the following comment in
So I tried updating |
* Adopt scp_recv2 instead, which uses compatible 64-bit stat types * Mark scp_recv as deprecated * small version bump Fixes alexcrichton#109 Refs alexcrichton#117 Co-authored-by: Joyce Babu <[email protected]>
* Adopt scp_recv2 instead, which uses compatible 64-bit stat types * Mark scp_recv as deprecated * small version bump Fixes alexcrichton#109 Refs alexcrichton#117 Co-authored-by: Joyce Babu <[email protected]>
When I download a file of 4 bytes size,
ScpFileStat.size()
shows 1552549416, which is actually current time.Some debug indicate that this issue is caused by different layout between
libc::windows::stat
andstat
.Here are the interpretations of same memory block for


libc::windows::stat
:and for
stat
:The
libssh2_struct_stat
have same layout withlibc::windows::stat
, however the input argument oflibssh2_scp_recv
inlibssh2-sys
is of typestat
, ref.Here is the memory layout of
libc::windows::stat
on my computer:type:
libc::windows::stat
: 56 bytes, alignment: 8 bytesfield
.st_dev
: 4 bytesfield
.st_ino
: 2 bytesfield
.st_mode
: 2 bytesfield
.st_nlink
: 2 bytesfield
.st_uid
: 2 bytesfield
.st_gid
: 2 bytespadding: 2 bytes
field
.st_rdev
: 4 bytes, alignment: 4 bytespadding: 4 bytes
field
.st_size
: 8 bytes, alignment: 8 bytesfield
.st_atime
: 8 bytesfield
.st_mtime
: 8 bytesfield
.st_ctime
: 8 bytesSize of
stat
: 48 bytes.My environment:
rustc 1.32.0 (9fda7c223 2019-01-16)
stable-x86_64-pc-windows-msvc and stable-x86_64-pc-windows-gnu(with MinGW-W64)
cargo.lock:
libssh2-sys 0.2.11
libc 0.2.50
The text was updated successfully, but these errors were encountered: