Bug 7544 - flashcp -v progress does not reach 100% reliably
Summary: flashcp -v progress does not reach 100% reliably
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 trivial
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-17 13:07 UTC by Ralph Siemsen
Modified: 2014-10-17 13:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
One possible fix. Has been tested using MTD_DEBUG. (623 bytes, patch)
2014-10-17 13:07 UTC, Ralph Siemsen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Siemsen 2014-10-17 13:07:29 UTC
Created attachment 5732 [details]
One possible fix. Has been tested using MTD_DEBUG.

This is very minor issue, but can cause confusion for end-users. Recent example:
http://forums.xilinx.com/t5/Embedded-Linux/flashcp-command-finish-99-when-Writing/td-p/533137

On certain sized files (for example, 3051kB), the output from verbose mode ("flashcp -v") is a bit misleading:

Erasing block: 48/48 (100%) 
Writing kb: 3048/3051 (99%) 
Verifying kb: 3048/3051 (99%)

In fact, all 3051kB were correctly written, even though it only shows 99% complete. This is because progress() reporting occurs before writing data, and no report occurs after the final (often partial) block is written.

This can easily be fixed by either:
- moving the existing progress() function call towards the end of the loop, or
- adding another call to progress() at the end of the loop to print 100%.

A trivial patch is attached. This produces the expected output:

Erasing block: 48/48 (100%) 
Writing kb: 3051/3051 (100%) 
Verifying kb: 3051/3051 (100%)