Skip to content

nl: keep numeric-looking file names verbatim in errors - #15544

Merged
cakebaker merged 2 commits into
uutils:mainfrom
emirmrkaljevic:nl-literal-filename
Oct 21, 2026
Merged

cakebaker merged 2 commits into
uutils:mainfrom
emirmrkaljevic:nl-literal-filename

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

Refs #15533

nl passed the directory name to translate!, which hands number-like arguments to Fluent as numbers, so a directory called 007, 1e3, 2.50 or +5 was reported reformatted:

$ mkdir 007 1e3
$ nl 007 1e3            # GNU coreutils 9.12
nl: 007: Is a directory
nl: 1e3: Is a directory
$ ./target/debug/nl 007 1e3   # uutils main
nl: 7: Is a directory
nl: 1000: Is a directory

This switches the nl-error-is-directory call to translate_text!, as in #15534 (tail) and #15541 (tac). The other nl errors don't go through translate! with a file name, so they were already fine. The new test fails on main and passes with the change; output now matches GNU 9.12 for 007, 1e3, 2.50 and +5.

Found with behave, which recorded GNU's behaviour and replayed it against uutils.

Windows quotes names such as 007 and 1e3 in messages, so the expected
output differs there.
@cakebaker
cakebaker merged commit 5ae99ef into uutils:main Oct 21, 2026
100 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