[PATCH] progressmeter: display of transfer speeds > 2GB/s
Cyril Servant
cyril.servant at cea.fr
Tue Mar 24 20:19:15 AEDT 2026
Hi,
during SFTP transfer tests (using my parallel-sftp patch), the transfer
speed exceeded 2 GB/s. The speed display then went out of range, showing
a negative speed.
Looking at the code, I saw that `bytes_per_second` and `cur_speed` are
`int`, limiting their value to 2147483647 B/s, or 2 GB/s.
Attached is a patch where I change the type to `long` (perhaps it would
be better to use `off_t`?), which allows high transfer speeds to be
displayed correctly.
I doubt such speeds are reasonably achievable with the vanilla version
of OpenSSH, but that could certainly change in the future (new hardware
/ new algorithms).
Thanks for considering,
Cyril Servant
diff --git a/progressmeter.c b/progressmeter.c
index 2c169768f..e676bbd1e 100644
--- a/progressmeter.c
+++ b/progressmeter.c
@@ -67,7 +67,7 @@ static off_t end_pos; /* ending position of
transfer */
static off_t cur_pos; /* transfer position as of last refresh */
static volatile off_t *counter; /* progress counter */
static long stalled; /* how long we have been stalled */
-static int bytes_per_second; /* current speed in bytes per second */
+static long bytes_per_second; /* current speed in bytes per second */
static int win_size; /* terminal window size */
static volatile sig_atomic_t win_resized; /* for window resizing */
static volatile sig_atomic_t alarm_fired;
@@ -128,7 +128,7 @@ refresh_progress_meter(int force_update)
double elapsed, now;
int percent;
off_t bytes_left;
- int cur_speed;
+ long cur_speed;
int hours, minutes, seconds;
int file_len, cols;
PS: If you're interested in the parallel-sftp patch, you can find it
here: https://github.com/cea-hpc/openssh-portable
More information about the openssh-unix-dev
mailing list