+
Skip to content

Conversation

alexsnaps
Copy link
Contributor

@alexsnaps alexsnaps commented Feb 18, 2025

Other units remain untouched and use uppercase K, as well as all other suffixes

This probably could take "some" test, but unsure which type is mostly desirable here? "Just" a plain unit test?
Tests are updated to reflect the change.
Also, I seem to see that parsing the input also fails when the suffix isn't uppercase, where as my numfmt (GNU coreutils) 9.5, seems lenient on the first character at least. Should this be a different issue? Should I work on adding that to this one? wdyt?

Other units remain untouched and use uppercase `K`, as well as all other suffixes

Signed-off-by: Alex Snaps <alex@wcgw.dev>
@alexsnaps
Copy link
Contributor Author

🙌 I guess I found the tests!

Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/tee is no longer failing!

Signed-off-by: Alex Snaps <alex@wcgw.dev>
@alexsnaps
Copy link
Contributor Author

alexsnaps commented Feb 18, 2025

My bad... ran cargo fmt in the wrong directory 🤦 (i.e. not in /tests)
I'll wait for the other tests to finish and I'll force push the fix rewriting the last test commit.

 Diff in /home/runner/work/coreutils/coreutils/tests/by-util/test_numfmt.rs:247:
         let args = ["--from=si", "--to=si", &format!("1{c}")];
 
         if valid_suffixes.contains(&c) {
-            let s = if c == 'K' {
-                'k'
-            } else {
-                c
-            };
+            let s = if c == 'K' { 'k' } else { c };
             new_ucmd!()
                 .args(&args)
                 .succeeds()
Error: Process completed with exit code 1.

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@alexsnaps
Copy link
Contributor Author

alexsnaps commented Feb 18, 2025

This should do it... let me wrt the casing leniency of the input.
Fix #7221

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

@alexsnaps alexsnaps changed the title Fix #7221: Unit::SI uses lowercase k for kilos numfmt: fix Unit::SI uses lowercase k suffix for kilos Feb 19, 2025
@jfinkels jfinkels linked an issue Feb 19, 2025 that may be closed by this pull request
@sylvestre sylvestre merged commit 8104822 into uutils:main Feb 24, 2025
65 checks passed
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.

numfmt: should use lowercase k with --to=si option

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载