Skip to content

join: accept a hyphen-leading -t separator, quote it in the error - #14318

Open
arbelonson-source wants to merge 1 commit into
uutils:mainfrom
arbelonson-source:fix/join-t-hyphen-value
Open

join: accept a hyphen-leading -t separator, quote it in the error#14318
arbelonson-source wants to merge 1 commit into
uutils:mainfrom
arbelonson-source:fix/join-t-hyphen-value

Conversation

@arbelonson-source

Copy link
Copy Markdown
Contributor

What

-t's value was rejected as an unrecognized flag when given as its
own argument:

$ join -t -x f1 f2

# GNU
join: multi-character tab '-x'

# uutils, before this PR
error: unexpected argument '-x' found
  tip: to pass '-x' as a value, use '-- -x'

The attached forms (-t-x, -t=x) already worked; only the
separate-argument form broke, the same allow_hyphen_values gap
already fixed this session for sort --parallel, nl's numeric
options, and ptx --gap-size/--width.

Also fixed

The resulting "multi-character tab" message doesn't quote the value,
a separate, pre-existing bug in the same code path (reachable before
this fix too, just via a non-hyphen multi-character value like -t ab, not only the hyphen-leading one this PR is really about):

# GNU
join: multi-character tab 'ab'

# uutils, before this PR
join: multi-character tab ab

Fixed since this fix's own regression test for the hyphen-leading
case would otherwise still fail against it -- a hyphen-leading
multi-character value reaches the exact same message construction as
any other one.

Testing

  • cargo test -p uu_join / full tests/by-util/test_join.rs suite: 46 passed, 0 failed.
  • Fixed the existing tab_multi_character test, which had encoded the unquoted wording as the expected result.
  • Added a regression test for the separate-argument hyphen-leading case (the actual reported bug).
  • Manually diffed -t -x, -t ab, -t :, -t - against GNU join 9.11 under LC_ALL=C.
  • cargo clippy -p uu_join --all-targets -- -D warnings and cargo fmt --check: clean.

This PR was written with AI assistance (Claude Opus 5, via Claude Code). I've tested the changes but please review the code carefully.

-t's value was rejected as an unrecognized flag when given as its own
argument (`join -t -x f1 f2`, not the attached `-tx` or `-t=x`): the
Arg was missing allow_hyphen_values, which every other option fixed
this way this session was too. GNU's own -t accepts any single
argument as the separator regardless of its first character.

Also quotes the value in the resulting "multi-character tab" message
to match GNU (`multi-character tab 'ab'`, not `multi-character tab
ab`) -- a separate, pre-existing bug in the same message that this
fix's own test would otherwise still fail against, since a
hyphen-leading multi-character value now reaches the exact same
message construction as any other one.

AI-assisted-by: Claude Opus 5, via Claude Code
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

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.

1 participant