Skip to content

pr: do not pad the last column of a line - #16140

Merged
sylvestre merged 1 commit into
uutils:mainfrom
DuncanBentley:pr-no-trailing-padding
Nov 2, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
DuncanBentley:pr-no-trailing-padding

Conversation

@DuncanBentley

Copy link
Copy Markdown
Contributor

GNU pr pads a column only to line up the next one, so a line never ends with spaces. uutils pads every cell, including the last one:

$ printf 'ab\nc\n' | pr -2 -t -w 9 -s'|' | od -c
GNU:    a b     |  c \n
uutils: a b     |  c       \n

This leaves the last cell of each row unpadded. In merge mode (-m), a file that has run out still gets its separator, as in GNU, and only the padding at the end of the line is dropped.

Most of the diff is the expected test output. I stripped the trailing spaces from the content lines of eight fixture files (column*.log.expected, mpr*.log.expected) and from the inline expectations in test_columns* and test_merge*. Nothing else in them changed. I checked the fixture commands against GNU pr: it prints no trailing spaces in any of them, apart from the -o offset on blank header lines (unchanged here) and the separators in merge mode.

I also added test_columns_last_column_not_padded.

This came up in review of #16078.

GNU pr pads a column only to line up the next one, so lines never end with spaces. Leave the last cell of a row unpadded and drop the trailing spaces from the expected test output.
@sylvestre
sylvestre merged commit f9fabcd into uutils:main Nov 2, 2026
136 of 137 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