create --progress: show big sizes with more decimals, fixes #3559 - #10088
Merged
ThomasWaldmann merged 1 commit intoAug 12, 2026
Merged
Conversation
…p#3559 At TB scale, the sizes shown by "borg create --progress" only changed every 10GB, so one could not tell whether it was still making progress. format_file_size (and the sizeof_fmt* helpers) now have a "fine" option giving big sizes a scale dependent precision, so that changes of ~1MB stay visible: GB: 3, TB: 6, PB: 9 decimals (capped at 9, a float can not resolve more anyway). Unit selection is not affected, so a size is always shown with the same unit as before. More decimals eat into the space left for the path, so on a terminal they are only used if it is at least 110 columns wide - even in the worst case, that still leaves more room for the path than 80 columns did before. If the output does not go to a terminal (e.g. into a logfile), the precise format is always used. The JSON progress output is unchanged.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10088 +/- ##
=======================================
Coverage 86.77% 86.78%
=======================================
Files 98 98
Lines 17277 17285 +8
Branches 2622 2623 +1
=======================================
+ Hits 14992 15000 +8
Misses 1587 1587
Partials 698 698 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3559.
At TB scale, the sizes in the
borg create --progressstatus line only changed every 10GB, soone could not tell whether it was still making progress (the more so when running from cron and
not seeing the beginning of the run).
Formatting
format_file_size(and thesizeof_fmt*helpers) got afine=Falseoption that gives big sizesa scale dependent precision, so that changes of ~1MB stay visible:
fine=True1.23 MB1.23 MB1.00 GB1.000 GB5.00 TB5.000001 TB5.00 PB5.000000001 PBDecimals are capped at 9 - a float can not resolve more anyway, and it bounds the output width.
Unit selection is deliberately unchanged (the rounding guard still uses the base precision), so
a size is never shown with a different unit than before. As a consequence,
999999000000showsas
0.999999 TBwhere the default format rounds to1.00 TB- the value is exact, the unit isthe same. There is a test for it.
Status line
@ThomasWaldmann noted in the issue that more digits shrink the space left for the path, which is
a problem at 80 columns, and that increasing the digits only for much wider terminals would be
the way to go. So:
fineadds at most 7 charsper size field, i.e. 14 for both, so even in the worst case the path still gets more room than
it had at 80 columns with the compact format. It is re-evaluated on every refresh, so resizing
the terminal degrades gracefully.
used - there is no width limit there.
At 80 columns nothing changes:
At 110 columns, 1MB steps become visible:
--stats/borg info/ all other size output keep the default 2 decimals (finedefaults toFalse, andStatistics.osize_fmt/usize_fmtare untouched).