coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

pr: multi-column mode uses spaces instead of tabs for inter-column padding

Open Khushi6767 opened this issue 2 weeks ago • 1 comments

Summary

In multi-column mode, pr pads between columns with SPACE characters (plus a single trailing TAB), while GNU pr pads between columns using TAB characters only. This produces visibly different output and breaks any downstream tooling or test that expects tab-separated columnar output (which is the documented GNU behavior pr is meant to match).

Reproduction

$ printf "line1\nline2\nline3\nline4\n" > test.txt
$ pr -2 test.txt | cat -A   # GNU coreutils 9.4
...
line1^I^I^I^I    line3$
line2^I^I^I^I    line4$
...
$ ./coreutils pr -2 test.txt | cat -A   # uutils
...
line1                              ^Iline3$
line2                              ^Iline4$
...

(^I is a literal TAB as shown by cat -A; $ marks end of line.)

GNU pr separates the first column from the second using four TAB characters (it tab-stops to the next column boundary), whereas uutils pads with literal SPACE characters and only emits a single TAB right before the second column starts. The visible text lines up the same way in a terminal with default tab stops, but the underlying bytes are different, which matters for:

  • Any script/test that greps or diffs pr output expecting GNU's tab-based layout
  • Any pipeline that re-processes pr output with tools that care about whitespace (e.g. expand, cut -f after converting tabs, etc.)
  • Compatibility with existing shell scripts written against GNU pr

Expected behavior

Inter-column padding in multi-column mode should use TAB characters (tab-stopping to the next column position), matching GNU pr's behavior, instead of SPACE-padding with a single trailing TAB.

Environment

  • uutils/coreutils: built from main (commit from around 2026-11)
  • Compared against: GNU coreutils 9.4
  • OS: Linux

Khushi6767 avatar Nov 16 '26 10:11 Khushi6767

Duplicate of #16510, which I opened yesterday for the same bug - sorry for the noise, closing this one.

Khushi6767 avatar Nov 16 '26 10:11 Khushi6767