scp: rounding bug in displayed transfer rate?

Brolin Empey brolin at brolin.be
Sun Mar 22 11:19:39 EST 2009


2009/3/20 Peter Stuge <peter at stuge.se>:
> 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..

The formal convention is to use 'B' for bytes and 'b' for bits.
However, many people mistakenly use 'b' for bytes.  I can usually
still tell what they mean because a combination such as "mb" for
megabytes really means millibits, which is impossible because a bit is
a fundamental unit of information.

I am a purist.  Incorrect common usage bothers me even if I know what is meant.

>> > 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.

Yes, I realise this.  The throughput field could be moved so it is the
last field on the line, but that would break compatibility with
scripts that expect the throughput field to be the second-last field.

The throughput field could also be interpreted as a boolean expression
in C:  the field's value is false if it is zero. :)

> 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.

I realise this too.  How about printing "-.-KB/s" instead of
"0.0KB/s"?  The '-'s mean no value is specified, but the presence of
the decimal point and rate indicate that a value would be specified
under non-exceptional conditions.


More information about the openssh-unix-dev mailing list