Skip to content

improve human readable output#459

Open
eworm-de wants to merge 9 commits into
RsyncProject:masterfrom
eworm-de:human
Open

improve human readable output#459
eworm-de wants to merge 9 commits into
RsyncProject:masterfrom
eworm-de:human

Conversation

@eworm-de

Copy link
Copy Markdown
Contributor

Calculate in a loop, use dynamic precision.

@eworm-de

Copy link
Copy Markdown
Contributor Author

As there is a new pre-release... Can I have a quick feedback and state on this?

@WayneD

WayneD commented May 1, 2023

Copy link
Copy Markdown
Member

The current release only has bugfixes in the main code (it's only the adjunct scripts & manpages that got enhancements).

I'm very cautious in making output-affecting changing, but will be giving this a closer look.

@eworm-de

eworm-de commented May 2, 2023

Copy link
Copy Markdown
Contributor Author

I can understand you are cautious about making output-affecting changing, guess this is due to breaking scripts that expect specific output?
My changes effect human readable output only, though. 😉 I hope this will not break anything.

@tridge

tridge commented Apr 6, 2024

Copy link
Copy Markdown
Member

@eworm-de could you add a description of the before and after of what this change does? Needs a bit more context than "improve" :-)

@eworm-de

eworm-de commented Apr 6, 2024

Copy link
Copy Markdown
Contributor Author

The commit messages have the details. Are you missing something there or just here in the pull request?

@eworm-de eworm-de force-pushed the human branch 2 times, most recently from 933dc1f to 75ea671 Compare April 7, 2024 18:01
@eworm-de

eworm-de commented Apr 7, 2024

Copy link
Copy Markdown
Contributor Author

This is the output of git log master..:

commit 75ea671e822b347cd4a6656d9913eb9fa89ff600 (HEAD -> human)
Author: Christian Hesse <mail@eworm.de>
Date:   Thu Mar 23 10:33:33 2023 +0100

    human-readable: add an "i" to unit to indicate binary (1024) base

commit 4f215ad2cf7b0dff74db74202412793a9947cadb
Author: Christian Hesse <mail@eworm.de>
Date:   Wed Mar 22 11:07:15 2023 +0100

    human-readable: also handle num < mult with the same code
    
    ... just make sure no precision is added.

commit d4784655035dcfdf02efb30164b181f47546713b
Author: Christian Hesse <mail@eworm.de>
Date:   Tue Mar 21 10:17:09 2023 +0100

    human-readable: use dynamic precision length
    
    Let's lower precision for huge numbers.
    
    The output used to be:
    
      3.45M -> 46.73M -> 523.11M -> 1.24G -> ...
    
    With this change the code always gives the three most significant digits:
    
      3.45M -> 46.7M -> 523M -> 1.24G -> ...

commit 53e4e68e9d5d195679db74e178c4d9e915094236
Author: Christian Hesse <mail@eworm.de>
Date:   Tue Mar 21 10:13:47 2023 +0100

    human-readable: calculate numbers in a loop
    
    This drops a lot of `else if` blocks and extends units
    by "E", "Z" & "Y".

@tridge

tridge commented Apr 7, 2024

Copy link
Copy Markdown
Member

@eworm-de ok, thanks, I normally expect it in the PR message
@WayneD are we concerned about users having parses these messages? Also, should we have a unit test for this?

@eworm-de eworm-de force-pushed the human branch 3 times, most recently from 0ca5744 to 6abcd9b Compare April 9, 2024 07:06
@eworm-de

eworm-de commented Apr 9, 2024

Copy link
Copy Markdown
Contributor Author

Just added another commit:

commit 7f26b1d2dd34ec39a566d0ba42a43bf22d6d5c46 (HEAD -> human, origin/human)
Author: Christian Hesse <mail@eworm.de>
Date:   Tue Apr 9 09:56:39 2024 +0200

    human-readable: also use it to format rate
    
    Let's also simplify the code for rate in progress, and benefit from
    same functionality.

@eworm-de eworm-de force-pushed the human branch 2 times, most recently from a20c3e6 to cb0b932 Compare April 11, 2024 06:31
@eworm-de

Copy link
Copy Markdown
Contributor Author

are we concerned about users having parses these messages?

I still stand by my point: This is about human readable output. We should not be worried too much about compatibility with parsers.

@eworm-de

Copy link
Copy Markdown
Contributor Author

Any news on this? Does it help if I split this across several pull requests?

@eworm-de eworm-de force-pushed the human branch 7 times, most recently from e05ae95 to 1b83598 Compare June 9, 2026 05:13

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sticking with this. I like the direction of making the formatter less hand-coded but I would request changes on the current patch.

Alongside my inline comments, the manpage progress examples are now stale and the current tests dont appear to cover the exact human-readable/progress output being changed here. Given this changes user-visible output, I think it needs focused formatter/progress coverage before merge alongside the bug fixes.

Comment thread progress.c Outdated
Comment thread lib/compat.c Outdated
Comment thread lib/compat.c Outdated
@eworm-de eworm-de force-pushed the human branch 2 times, most recently from 4b09949 to b833d8c Compare June 9, 2026 10:02
@eworm-de eworm-de requested a review from steadytao June 9, 2026 10:03

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick overall thing as well as the inlines. The manpage progress examples are still stale and the tests still only check very broad output properties. Since this PR intentionally changes user-visible formatting, I think it needs very focused tests for the formatter and at least one exact progress/final-stats shape before merge.

Comment thread lib/compat.c Outdated
Comment thread progress.c Outdated
@eworm-de

Copy link
Copy Markdown
Contributor Author

The manpage progress examples are still stale

Ups, I was not aware that the dynamic precision never made it into the man page. Updated... Is that sufficient?

and the tests still only check very broad output properties. Since this PR intentionally changes user-visible formatting, I think it needs very focused tests for the formatter and at least one exact progress/final-stats shape before merge.

Agreed. But the test suite is (mostly?) python, and I am not very familiar with that. Any help appreciated...

@eworm-de eworm-de force-pushed the human branch 3 times, most recently from ad844de to e329ff1 Compare June 10, 2026 20:32

@steadytao steadytao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Awaiting @tridge review.

@eworm-de

Copy link
Copy Markdown
Contributor Author

Oh, you pushed commit into my pull request. Gladly I noticed before I force-pushed my rebase. 😄️

Some of your changes are more cleanups for my commits. Is it ok for you if I clean up the history a bit?

Also some of the code is heavily influenced by you. Are you fine if I add Co-authored-by for you into my commits?

@steadytao

Copy link
Copy Markdown
Member

Some of your changes are more cleanups for my commits. Is it ok for you if I clean up the history a bit?

Feel happy to. You can even make changes if you notice anything. It is your branch 😁

Also some of the code is heavily influenced by you. Are you fine if I add Co-authored-by for you into my commits?

I wouldn't mind either way but thank you for the offer, of course you can!

eworm-de and others added 9 commits June 11, 2026 11:02
This drops a lot of `else if` blocks and extends units by "E" (Exa),
which is 2^60 and thus the last to fit into int64.

Co-authored-by: Zen Dodd <mail@steadytao.com>
Co-authored-by: Zen Dodd <mail@steadytao.com>
Let's lower precision for huge numbers.

The output used to be:

  3.45M -> 46.73M -> 523.11M -> 1.24G -> ...

With this change the code always gives the three most significant digits:

  3.45M -> 46.7M -> 523M -> 1.24G -> ...

Co-authored-by: Zen Dodd <mail@steadytao.com>
... just make sure no precision is added.

Co-authored-by: Zen Dodd <mail@steadytao.com>
Co-authored-by: Zen Dodd <mail@steadytao.com>
Let's also simplify the code for rate in progress, and benefit from
same functionality.

Co-authored-by: Zen Dodd <mail@steadytao.com>
... and also fix the formatting in man page.

Co-authored-by: Zen Dodd <mail@steadytao.com>
@eworm-de

Copy link
Copy Markdown
Contributor Author

Shuffled a bit... The result should be the same. Again, thanks a lot!

@steadytao

Copy link
Copy Markdown
Member

Thank you for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants