Skip to content

pr: with -d, no blank line after a last line that lacks a newline - #16636

Merged
cakebaker merged 1 commit into
uutils:mainfrom
Xnadir:pr-double-space-unterminated
Nov 18, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
Xnadir:pr-double-space-unterminated

Conversation

@Xnadir

@Xnadir Xnadir commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

With -d and no header (-t, -T, or a page shorter than 11 lines), a last line without a newline was followed by an extra blank line:

$ printf 'a\nb' | pr -t -d
a

b
                 # extra blank line; GNU stops after "b"

GNU adds the blank line of -d only after a line that ended with a newline. FileLine now records whether it is an unterminated last line, and write_columns ends that row with a single newline in single-column output without a header. With a header and trailer the page is padded to its length anyway, and -F keeps the blank line, as GNU does. Multi-column output is unchanged.

The test covers a, a\nb and a\nb\n with -t -d, and fails on main. I compared a matrix of inputs (with and without a final newline, form feeds) and options (-d, -t -d, -d -l 10, -d -n -t, -d -F, -T -d, -t -d -o 2) against GNU pr. Every case either matches GNU now or behaves as on main. The only GNU build I have locally is coreutils 8.32.

AI disclosure: written with help from Claude Code. Nothing was derived from GNU source.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 15:30

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.49 MB (+108 KB, +0.07%)

Significant per-binary changes:
  env     1.20 MB ->    1.28 MB  (+80 KB, +6.51%)

@cakebaker
cakebaker merged commit 06d05ee into uutils:main Nov 18, 2026
104 of 106 checks passed
@cakebaker

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.

3 participants