Skip to content

unexpand: accept a blank as a tab-list separator like GNU - #14057

Open
AlejandroCoronadoN wants to merge 1 commit into
uutils:mainfrom
AlejandroCoronadoN:unexpand-space-tab-separator
Open

unexpand: accept a blank as a tab-list separator like GNU#14057
AlejandroCoronadoN wants to merge 1 commit into
uutils:mainfrom
AlejandroCoronadoN:unexpand-space-tab-separator

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor

GNU unexpand accepts both a comma and a blank between tab stops in -t/--tabs, so unexpand -t '2 3' behaves like unexpand -t '2,3'. uutils only splits on a comma, so the space form is rejected:

$ printf '  a   b\n' | unexpand -t '2 3' -a
unexpand: tab size contains invalid character(s): ' 3'

uutils' own expand already accepts both separators via an is_space_or_comma helper; only unexpand was inconsistent. This splits the tab list on a space or a comma too, mirroring expand. Verified byte for byte against GNU unexpand in the C locale for '2 3', ' 2 3', '2 3', '2, 3' and '1 4 7'; invalid values like -t x still error as before.

@codspeed-hq

codspeed-hq Bot commented Aug 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 290 untouched benchmarks
⏩ 117 skipped benchmarks1


Comparing AlejandroCoronadoN:unexpand-space-tab-separator (80248df) with main (3d09364)

Open in CodSpeed

Footnotes

  1. 117 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 21, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/rm/isatty (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/symlink (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)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.
Congrats! The gnu test tests/cp/link-heap is now passing!

Comment thread src/uu/unexpand/src/unexpand.rs Outdated
}

/// Decide whether the character is either a space or a comma.
fn is_space_or_comma(c: char) -> bool {

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.

Not a useful function. Please remove it and write code directly.

@AlejandroCoronadoN
AlejandroCoronadoN force-pushed the unexpand-space-tab-separator branch from 2a16155 to 80248df Compare August 21, 2026 09:41
@AlejandroCoronadoN

Copy link
Copy Markdown
Contributor Author

Good point, removed the helper and inlined it as s.split([' ', ',']). Thanks for the review!

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