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 • 0 comments

Description

In multi-column mode (-2, -3, etc.), GNU pr pads the space between columns using TAB characters. uutils pr uses SPACE characters followed by a single trailing TAB instead.

This affects all multi-column modes (-2, -3, -a) and occurs with and without custom separators (-s).

How to reproduce

printf 'a\nb\nc\nd\ne\nf\n' > test.txt

# GNU pr
pr -2 -t test.txt | od -c

# uutils pr
coreutils pr -2 -t test.txt | od -c

Expected output (GNU behavior)

0000000   a  \t  \t  \t  \t                   d  \n   b  \t  \t  \t  \t
0000020                   e  \n   c  \t  \t  \t  \t                   f
0000040  \n

GNU uses TAB characters to advance from the end of the left column text to the start of the right column.

Visible with cat -A:

a^I^I^I^I    d$
b^I^I^I^I    e$
c^I^I^I^I    f$

Actual output (uutils)

0000000   a                                                            
0000020                                                                
0000040              \t   d  \n   b                                    
...

uutils fills the gap with SPACE characters (34 spaces) followed by a single TAB, instead of using TABs as GNU does.

Visible with cat -A:

a                                  ^Id$
b                                  ^Ie$
c                                  ^If$

Impact

Programs or scripts that parse pr output and rely on TAB-delimited columns will break when using the uutils version. The visual output may appear similar, but the byte-level content differs significantly.

Environment

  • uutils coreutils built from latest main branch
  • Compared against GNU coreutils 9.4
  • Tested on Linux x86_64

Khushi6767 avatar Nov 15 '26 11:11 Khushi6767