Skip to content

shred: keep numeric-looking file names verbatim in messages - #15604

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

sylvestre merged 1 commit into
uutils:mainfrom
emirmrkaljevic:shred-literal-filename

Conversation

@emirmrkaljevic

Copy link
Copy Markdown
Contributor

Refs #15533

shred passed file names to translate!, which hands any value that parses as a number to Fluent as a number, so numeric-looking names were reformatted in errors and -v output:

$ mkdir 007; touch 1e3
$ shred 007
shred: 7: Not a file          # GNU: shred: 007: failed to open for writing: Is a directory
$ shred 1e4
shred: 10000: No such file or directory
$ shred -v -u 1e3
shred: 1000: removing
...
shred: 1000: removed

This switches the messages that carry a file name (including the "couldn't rename" message, whose new name is all zeros) to translate_text!, the same fix as in #15534, #15541, #15544, #15548 and #15565. The message wording itself is unchanged here.

Tests: rstest cases for the error path and a -v -u case; they fail on main and pass with the fix.

Found with behave.

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

Found with behave (https://github.com/emirmrkaljevic/behave).
@sylvestre
sylvestre merged commit 744e299 into uutils:main Oct 22, 2026
98 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

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