Skip to content

base32/base64/basenc: accept a -w value starting with - to match GNU - #14084

Open
AlejandroCoronadoN wants to merge 3 commits into
uutils:mainfrom
AlejandroCoronadoN:base-wrap-hyphen-value
Open

base32/base64/basenc: accept a -w value starting with - to match GNU#14084
AlejandroCoronadoN wants to merge 3 commits into
uutils:mainfrom
AlejandroCoronadoN:base-wrap-hyphen-value

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor

base64 -w -5 (and any -w value that starts with -, e.g. -w -d) was rejected by the argument parser with unexpected argument '-5' found, while GNU takes the token after -w as the wrap size and reports invalid wrap size:

$ printf abc | base64 -w -5
error: unexpected argument '-5' found
$ printf abc | gbase64 -w -5
gbase64: invalid wrap size: '-5'

Adding allow_hyphen_values(true) to the -w/--wrap argument lets the value reach the existing wrap-size parser, which already emits the GNU-matching message. Verified against GNU for -w -5, -w -d, -w -x (all invalid wrap size), with valid values (-w 5, -w0, --wrap=5) and decoding unchanged. The shared base_common.rs covers base32, base64 and basenc.

@codspeed-hq

codspeed-hq Bot commented Aug 22, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 357 untouched benchmarks
⏩ 50 skipped benchmarks1


Comparing AlejandroCoronadoN:base-wrap-hyphen-value (4256338) with main (05a2eee)

Open in CodSpeed

Footnotes

  1. 50 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.

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/dd/misc. tests/dd/misc is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/df/over-mount-device. tests/df/over-mount-device is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cat/splice is no longer failing!
Congrats! The gnu test tests/cut/cut is no longer failing!
Congrats! The gnu test tests/cut/mb-non-utf8 is no longer failing!
Congrats! The gnu test tests/dd/partial-write is no longer failing!
Congrats! The gnu test tests/expand/mb is no longer failing!
Congrats! The gnu test tests/ls/stat-free-symlinks is no longer failing!
Congrats! The gnu test tests/mktemp/write-error is no longer failing!
Congrats! The gnu test tests/mv/dir2dir is no longer failing!
Congrats! The gnu test tests/mv/mv-exchange is no longer failing!
Congrats! The gnu test tests/nl/multibyte is no longer failing!
Congrats! The gnu test tests/od/od-float is no longer failing!
Congrats! The gnu test tests/od/od-j is no longer failing!
Congrats! The gnu test tests/ptx/ptx-overrun is no longer failing!
Congrats! The gnu test tests/sort/sort-merge-fdlimit is no longer failing!
Congrats! The gnu test tests/unexpand/mb is no longer failing!
Note: The gnu test tests/dd/fail-ftruncate-fstat was skipped on 'main' but is now failing.

Comment thread src/uu/base32/src/base_common.rs Outdated
sylvestre and others added 2 commits August 24, 2026 14:59
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
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.

3 participants