-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(df): add thousands separator support #9090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
3ce60cf to
48f4bc1
Compare
|
GNU testsuite comparison: |
a8966af to
ae09fec
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
could you please split this per program in different pr ? thanks |
| /// - `','` for other locales (default, en_US style) | ||
| fn get_thousands_separator() -> char { | ||
| // Try to read LC_NUMERIC or LANG environment variable | ||
| if let Ok(locale) = std::env::var("LC_NUMERIC") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Environment variable reads on every call is inefficient - consider caching the locale information
|
|
||
| // Simple heuristic: European locales use period, others use comma | ||
| // This covers common cases like de_DE, fr_FR, it_IT, es_ES, nl_NL, etc. | ||
| if locale.starts_with("de_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it?
i don't like this hardcoded list. isn't something in icu to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki, replace with ICU's FixedDecimalFormatter
|
GNU testsuite comparison: |
8b92113 to
fb15063
Compare
fb15063 to
13225ab
Compare
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging #9090 will not alter performanceComparing Summary
Footnotes
|
|
GNU testsuite comparison: |
8aa4f8c to
c6cb13e
Compare
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
29d396b to
e85ae66
Compare
|
GNU testsuite comparison: |
e85ae66 to
714a5a2
Compare
|
GNU testsuite comparison: |
714a5a2 to
3be82c4
Compare
faf2e81 to
eae9883
Compare
|
GNU testsuite comparison: |
eae9883 to
c46965b
Compare
|
GNU testsuite comparison: |
6be679f to
bb7d375
Compare
|
GNU testsuite comparison: |
bb7d375 to
a9b8ee7
Compare
|
GNU testsuite comparison: |
a9b8ee7 to
e7966cf
Compare
|
GNU testsuite comparison: |
|
i found that |
- Change get_decimal_separator() to accept &Locale instead of Locale - Eliminates problematic .clone() that caused stale thread stack memory - Fixes valgrind failures in tests/sort/sort-stale-thread-mem test - More efficient (avoids unnecessary clone operation)
e7966cf to
ecfd22f
Compare
|
GNU testsuite comparison: |
build-gnu.sh: Use MULTICALL=y and skip not used utils for faster build
* CICD.yml: Avoid no space left much more * Remove both of android and dotnet Co-authored-by: Sylvestre Ledru <sylvestre@debian.org> --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
…s#9136) * feat(dd): add comprehensive benchmark suite for O_DIRECT optimization - Create dd's first benchmark suite using divan framework - Benchmark various block sizes (4K, 8K, 64K, 1M) to measure performance - Test different dd scenarios: default, partial copy, skip, seek operations - Measure impact of separate input/output block sizes - All benchmarks use status=none to avoid output noise - Benchmarks verify the O_DIRECT buffer alignment optimization - Follows existing uutils benchmark patterns and conventions * bench(dd): increase dataset sizes for consistent timing Increase benchmark dataset sizes to achieve consistent 100-300ms timing: - dd_copy_default: 16 -> 32 MB - dd_copy_4k_blocks: 16 -> 24 MB - dd_copy_64k_blocks: 16 -> 64 MB - dd_copy_1m_blocks: 16 -> 128 MB - dd_copy_separate_blocks: 16 -> 48 MB - dd_copy_partial: 16 -> 32 MB - dd_copy_with_skip: 16 -> 48 MB - dd_copy_with_seek: 16 -> 48 MB - dd_copy_8k_blocks: 16 -> 32 MB This ensures stable, repeatable benchmark measurements across different systems. --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
No need to use the unsafe `libc::execvp()`, the standard rust library provides the functionality via the safe function `Command::exec()`. Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
…tils#9884) * du: fix -l/--count-links option not counting hardlinks separately * du: add test for -l/--count-links counting hardlinks separately --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
…nt dirs (uutils#9803) Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
…gile configurations Addresses PR uutils#9653 review feedback about 'fragile commands' by implementing fail-fast validation in Parser builder pattern. Changes: - Add ParserBuilderError enum with 8 validation error variants - Refactor builder methods to return Result<&mut Self, ParserBuilderError> - Implement comprehensive unit validation (57 valid units including k/m/g/t) - Add cross-validation between builder settings (default_unit vs allow_list) - Detect conflicts (b_byte_count with 'b' unit, '%' with size units) - Update all call sites (sort, du, df, od) to handle new error types - Fix invalid '%' unit in sort's parse_byte_count allow_list Benefits: - Configuration errors detected immediately (not during parsing) - Clear error messages listing invalid/conflicting settings - Maintains backward compatibility through explicit error reporting Files modified: - src/uucore/src/lib/features/parser/parse_size.rs (core implementation) - src/uu/sort/src/sort.rs (error handling + fix invalid '%') - src/uu/du/src/du.rs (error handling) - src/uu/df/src/df.rs (error handling) - src/uu/od/src/od.rs (error handling)
9216589 to
b854560
Compare
|
GNU testsuite comparison: |
|
@naoNao89 there seems to be changes unrelated to the PR, (dd, install), is that a rebase issue? |
Adds GNU-compatible thousands separator formatting to ls, du, and df. Use a leading quote in --block-size to get readable output: --block-size="'1" shows 1,024,000 instead of 1024000.
Respects LC_NUMERIC locale (comma for en_US, period for European locales, none for C/POSIX). Works with environment variables too (LS_BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, etc.).
Core changes in uucore (parse_size.rs, human.rs) handle the parsing and formatting. Each utility integrates it with minimal changes. 12 new integration tests, all existing tests pass.
Closes #9084