scp: rounding bug in displayed transfer rate?

Peter Stuge peter at stuge.se
Sat Mar 21 04:24:49 EST 2009


Brolin Empey wrote:
> > But the transfer didn't last one full second. Had it done so, the
> > actual transfer rate would quite likely be higher than 6b/s.
> 
> You mean 6 B/s.  6 b/s is less than 1 B/s. :P

Personally I make no difference between b and B. Conventions differ
almost on a personal basis so I just keep it simple with lowercase
all the time. For bits per second my preference is to use bps. I
guess a habit from the modem days..


> > It's simply impossible to calculate an average when there isn't an
> > excess of data. Here, the transfer rate resolution is one second.
> 
> Then why does scp try to calculate an average when it has
> insufficient data?

I think there are two reasons for this;

1. It is a corner case where accuracy does not make a big difference.
   Being a corner case means that some amount of code needs to go
   into OpenSSH to cover it, but that code would not run very often.
   That's bad from a security/code quality perspective. The fact that
   the inaccuracy is near unmeasurable further motivates ignoring the
   problem.

2. Noone has felt strongly about making this more accurate.

I do not know which is the stronger motivator, but I think both are
important reasons.


> > Would you consider an "unmeasurable" style message to be an
> > improvement for cases when no transfer rate can be calculated?
> 
> No, I do not think scp should say anything in these cases because
> such a message violates the Rule of Silence:

Hm. A little problematic because the other fields still have valid
information. Omitting the throughput field would introduce a rather
messy inconsistency in the program's output.

If I were to interpret scp output programmatically I would be able to
deal with 0 much more easily than <no value specified> especially
since I may be using whitespace as field separator.


> <http://www.catb.org/~esr/writings/taoup/html/ch01s06.html#id2878450>
> 
> Incidentally, I think this discussion list should allow rich
> (hyper)text mail so I can link parts of my prose instead of pasting
> URLs:

In this case I'd suggest to simply quote the rule (just the rule
though) and save people who read your message a web dereference.


It's quite interesting how two totally f*ed up technologies (web and
email) can combine into something that people live their lives by.

Webmail: Two wrongs don't make a right!


//Peter


More information about the openssh-unix-dev mailing list