feat(sort): add warning messages for obsolescent keys and options#9900
Merged
sylvestre merged 12 commits intouutils:mainfrom Jan 13, 2026
Merged
feat(sort): add warning messages for obsolescent keys and options#9900sylvestre merged 12 commits intouutils:mainfrom
sylvestre merged 12 commits intouutils:mainfrom
Conversation
Added localized warning messages in en-US.ftl for various sort command issues, including obsolescent key formats, ignored options, and locale-related warnings. Implemented LegacyKeyWarning struct and GlobalOptionFlags in sort.rs to detect deprecated key syntax (e.g., +field -field) and suggest modern -k replacements, improving user guidance and compatibility.
Removes the unused `stable` and `unique` boolean fields from the GlobalOptionFlags struct and their initialization in the impl block, simplifying the code by eliminating redundant options.
|
GNU testsuite comparison: |
Previously, sort mode flags were mutually exclusive, preventing users from specifying more than one mode. This change removes the conflicts to enable combining sort options for more flexible sorting behavior.
CodSpeed Performance ReportMerging #9900 will not alter performanceComparing Summary
Footnotes
|
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Contributor
|
thanks. It needs some tests |
Contributor
|
also, please have a look on the perf regression - -4.52% is quite high |
|
GNU testsuite comparison: |
- Update LegacyKeyWarning struct to include arg_index and make key_index optional - Modify preprocess_legacy_args to set arg_index instead of key_index during parsing - Add index_legacy_warnings function to compute key_index after arg processing - Adjust emit_debug_warnings to match updated key_index type - This ensures accurate indexing for legacy key warnings in sort utility
|
GNU testsuite comparison: |
- Introduce `starts_with_plus` function to check for arguments starting with '+' in a platform-specific manner - Modify `parse_sort_arguments` to detect and process legacy sort keys, enabling proper handling of deprecated options with warnings - This ensures backward compatibility for users relying on old sort syntax while guiding migration to modern flags
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Remove intermediate vector creation in preprocess_legacy_args and streamline the handling of legacy '+' prefixed arguments to improve efficiency and readability without altering functionality. Additionally, refactor uumain to directly index legacy warnings when present.
|
GNU testsuite comparison: |
…g args Move output file creation and argument setup outside benchmark loops in sort_locale_utf8_bench.rs to avoid measuring initialization time in each iteration, ensuring accurate performance measurements for sorting operations.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
mattsu2020
added a commit
to mattsu2020/coreutils
that referenced
this pull request
Jan 23, 2026
…tils#9900) * feat(sort): add warning messages for obsolescent keys and options Added localized warning messages in en-US.ftl for various sort command issues, including obsolescent key formats, ignored options, and locale-related warnings. Implemented LegacyKeyWarning struct and GlobalOptionFlags in sort.rs to detect deprecated key syntax (e.g., +field -field) and suggest modern -k replacements, improving user guidance and compatibility. * refactor(sort): remove stable and unique flags from GlobalOptionFlags Removes the unused `stable` and `unique` boolean fields from the GlobalOptionFlags struct and their initialization in the impl block, simplifying the code by eliminating redundant options. * feat(sort): allow multiple sort modes by removing mutual conflicts Previously, sort mode flags were mutually exclusive, preventing users from specifying more than one mode. This change removes the conflicts to enable combining sort options for more flexible sorting behavior. * refactor(sort): separate arg_index and key_index in legacy key warnings - Update LegacyKeyWarning struct to include arg_index and make key_index optional - Modify preprocess_legacy_args to set arg_index instead of key_index during parsing - Add index_legacy_warnings function to compute key_index after arg processing - Adjust emit_debug_warnings to match updated key_index type - This ensures accurate indexing for legacy key warnings in sort utility * feat(sort): add legacy sort key detection for '+' prefixed arguments - Introduce `starts_with_plus` function to check for arguments starting with '+' in a platform-specific manner - Modify `parse_sort_arguments` to detect and process legacy sort keys, enabling proper handling of deprecated options with warnings - This ensures backward compatibility for users relying on old sort syntax while guiding migration to modern flags * refactor(sort): simplify legacy args preprocessing Remove intermediate vector creation in preprocess_legacy_args and streamline the handling of legacy '+' prefixed arguments to improve efficiency and readability without altering functionality. Additionally, refactor uumain to directly index legacy warnings when present. * refactor(sort/benches): optimize locale UTF8 benchmarks by predefining args Move output file creation and argument setup outside benchmark loops in sort_locale_utf8_bench.rs to avoid measuring initialization time in each iteration, ensuring accurate performance measurements for sorting operations. --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
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.
Added localized warning messages in en-US.ftl for various sort command issues, including obsolescent key formats, ignored options, and locale-related warnings. Implemented LegacyKeyWarning struct and GlobalOptionFlags in sort.rs to detect deprecated key syntax (e.g., +field -field) and suggest modern -k replacements, improving user guidance and compatibility.
fix
sort/sort-debug-warn.sh