ropensci / ssh

Native SSH client in R based on libssh
https://docs.ropensci.org/ssh
Other
127 stars 21 forks source link

scp_upload negative progress % #27

Closed jxu closed 4 years ago

jxu commented 5 years ago

Strangely when I use scp_upload progress will go from 0% to 4%, then wraparound to -4% and continue incrementing (so only values -4% to 4% are displayed).

The file I am transferring is 574236321 bytes. This is a little over 1/4 of the max value of an int. Thus when multiplying by 100 we easily get an overflow.

https://github.com/ropensci/ssh/blob/8967d3ecc97cc624bcddfab6a5ff0408d932774d/src/scp.c#L184-L196

Fix is simple: use a long for total. I can attempt a PR if you wish.