Skip to content

sort: keep numeric-looking file names verbatim in errors - #15565

Merged
cakebaker merged 1 commit into
uutils:mainfrom
emirmrkaljevic:sort-literal-filename
Oct 22, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
emirmrkaljevic:sort-literal-filename

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

Part of #15533.

sort passed file names to translate!, which gives Fluent any value that parses as a number as a number, so numeric-looking names were reformatted in error messages:

$ sort 1e3
sort: cannot read: 1000: No such file or directory   # GNU: 1e3
$ mkdir 007; sort -o 007 /dev/null
sort: open failed: 7: Is a directory                  # GNU: 007
$ sort --files0-from=1e3
sort: open failed: 1000: No such file or directory   # GNU: 1e3

This switches the sort messages that carry a file name to translate_text!, the same change as in #15534, #15541, #15544 and #15548. Output now matches GNU sort.

Added an rstest case per message in test_sort.rs; they fail on main and pass with the fix.

Found with behave.

The error messages passed file names to translate!, which hands any
value that parses as a number to Fluent as a number, so "1e3" was
reported as "1000" and an output directory named "007" as "7". Use
translate_text! for the messages that carry a file name, so they are
printed as given, like GNU sort.

Found with behave (https://github.com/emirmrkaljevic/behave).
@cakebaker
cakebaker merged commit af82586 into uutils:main Oct 22, 2026
100 of 102 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

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.

2 participants