Skip to content

join: let -o accumulate fields across occurrences like GNU - #14070

Open
AlejandroCoronadoN wants to merge 1 commit into
uutils:mainfrom
AlejandroCoronadoN:join-repeated-o-accumulate
Open

join: let -o accumulate fields across occurrences like GNU#14070
AlejandroCoronadoN wants to merge 1 commit into
uutils:mainfrom
AlejandroCoronadoN:join-repeated-o-accumulate

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor

GNU join lets -o FORMAT appear more than once; the field specs from every occurrence accumulate in order. uutils rejects a repeated -o with a hard error:

$ join -o 1.1 -o 1.2 -o 2.2 file1 file2
join: the argument '-o <FORMAT>' cannot be used multiple times
# GNU accumulates the fields and prints 1.1 1.2 2.2

This makes several -o accumulate, matching GNU, including the auto corner cases: auto mode applies only when every -o value is exactly auto, otherwise each auto is ignored and the real specs accumulate. It uses the existing ArgAction::Append idiom (as -a and -v already do). Single--o behavior and the per-field diagnostics are unchanged.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (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)

@sylvestre

Copy link
Copy Markdown
Contributor

Please fix the conflict

@AlejandroCoronadoN
AlejandroCoronadoN force-pushed the join-repeated-o-accumulate branch from cfacabc to a1e7a51 Compare August 22, 2026 12:42
@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor Author

Fixed the conflict, rebased onto current main (the change now sits on top of the new -o caret diagnostics). Thanks!

}

#[test]
fn repeated_o_ignores_auto_when_mixed() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is a bit unlucky as both -o auto and -o 1.1 2.2 on their own have the same output and so, when combined, you can't say which option got ignored. I would use a different format for the second option.

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