uucore: ignore symbols like + | ~ at the first level of locale collation #16237
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
comm and join check the input order with their own collator (no max_variable), so sort | comm will now say "not in sorted order" for lines like +5.
could you please make comm/join (and expr) use the same options, ideally through init_locale_collation?
please also add a test where comm or join reads this sort output without complaining
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Thanks. comm, join and expr now take their collator options from the same function as sort, locale_collator_options() in collator.rs, and each keeps its own init as before (a0526f1). With the quaternary strength sort already uses, comm and join no longer treat lines that differ only in punctuation, like a-b and ab, as equal.
Added test_sort_locale_symbols_comm_check_order: sort's output for +5 and 10 goes to comm --check-order, which accepts it.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
<!-- __CODSPEED_PERFORMANCE_REPORT_COMMENT__ -->
Merging this PR will degrade performance by 65.92%
<details>
<summary><b>1 warning, 1 note</b></summary>
:warning: 125 benchmarks are dominated by system calls
> System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
> Learn more about system calls
> See affected benchmarks
:information_source: 1 benchmark has no flamegraph
> The flamegraph wasn't generated: most of the time was spent in runtime internals, which would leave nothing useful to analyze.
> See affected benchmarks
</details>
❌ 3 regressed benchmarks ✅ 412 untouched benchmarks ⏩ 70 skipped benchmarks[^skipped]
[!WARNING]
Please fix the performance issues or acknowledge them on CodSpeed.
Performance Changes
| | Mode | Benchmark | BASE | HEAD | Efficiency |
| --- | ---- | --------- | ------ | ------ | ---------- |
| ❌ | Memory | [` socket_addrs_direct[100000] ](https://app.codspeed.io/uutils/coreutils/branches/jayhemnani9910%3Asort-collate-symbols?uri=src%2Fuu%2Fhostname%2Fbenches%2Fhostname_bench.rs%3A%3Asocket_addrs_direct%255B100000%255D&runnerMode=Memory&utm_source=github&utm_medium=comment-v2&utm_content=benchmark) | 8.6 KB | 68 KB | -87.29% |
| ❌ | Memory | timeout_enforced | 88.8 KB | 179.6 KB | -50.56% |
| ❌ | Memory | [ hostname_ip_lookup[100000] ](https://app.codspeed.io/uutils/coreutils/branches/jayhemnani9910%3Asort-collate-symbols?uri=src%2Fuu%2Fhostname%2Fbenches%2Fhostname_bench.rs%3A%3Ahostname_ip_lookup%255B100000%255D&runnerMode=Memory&utm_source=github&utm_medium=comment-v2&utm_content=benchmark) | 100.9 KB | 160.2 KB | -37.06% |
[!TIP]
Investigate this regression by commenting @codspeedbot fix this regression` on this PR, or directly use the CodSpeed MCP with your agent.
---
<sub>Comparing <code>jayhemnani9910:sort-collate-symbols</code> (1e9dfae) with <code>main</code> (887b9e6)[^unexpected-base]</sub>
<a href="https://app.codspeed.io/uutils/coreutils/branches/jayhemnani9910%3Asort-collate-symbols?utm_source=github&utm_medium=comment-v2&utm_content=button">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://codspeed.io/pr-report/open-in-codspeed-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://codspeed.io/pr-report/open-in-codspeed-light.svg">
<img alt="Open in CodSpeed" src="https://codspeed.io/pr-report/open-in-codspeed-light.svg" width="169" height="32">
</picture>
</a>
[^skipped]: 70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.
[^unexpected-base]: No successful run was found on <code>main</code> (9137846) during the generation of this report, so 887b9e6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
sylvestre
jayhemnani9910
In a UTF-8 locale, GNU sort and ls ignore symbols such as
+ < = > ^| ~at the first level, the same way they ignore punctuation. Ours only treats punctuation as variable, so these lines sort ahead of letters and digits:The collator already uses AlternateHandling::Shifted
. This setsmax_variabletoMaxVariable::Symboltoo, so symbols are shifted like punctuation and spaces. Currency symbols stay non-variable, which already matches GNU ($5still sorts before10in both). The change is ininit_locale_collation, so it applies to sort, ls and test. comm, join and expr set up their own collator and are not changed.Testing (en_US.UTF-8, GNU coreutils 9.7 as reference):
: fails on main, passes with the change.: 549 passed.| ~before a digit: same order asgnusortnow. The existing punctuation cases (file-10,E-U/E.U/EU) are unchanged.-n,-fand other modes are still broken by bytes, which #13319 / #16090 cover.