emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46422: closed ('pr' screws up tabstops in multicolumn outpt?)


From: GNU bug Tracking System
Subject: bug#46422: closed ('pr' screws up tabstops in multicolumn outpt?)
Date: Mon, 15 Feb 2021 21:34:01 +0000

Your message dated Mon, 15 Feb 2021 21:33:03 +0000
with message-id <0a0d4618-ed3f-33c7-d5cf-3e26da29ac9b@draigBrady.com>
and subject line Re: bug#46422: [PATCH] Re: bug#46422: 'pr' screws up tabstops 
in multicolumn outpt?
has caused the debbugs.gnu.org bug report #46422,
regarding 'pr' screws up tabstops in multicolumn outpt?
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
46422: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=46422
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 'pr' screws up tabstops in multicolumn outpt? Date: Wed, 10 Feb 2021 13:42:29 +0100 User-agent: Evolution 3.38.3 (by Flathub.org)
I'm sorry if I this is not a bug but to be expected, but I thnk pr
doesn't get the alignment of tabs in multicolumn output right.

Consider the following test input, where everything from x->x is a tab
(with tabs 8):

123456781234567812345678123456781
x       x       x       x       x
123456781234567812345678123456781
x       x       x       x       x

Run it through multicolumn pr, e.g.,

    pr -t -2 test > out

The output looks like:

123456781234567812345678123456781   123456781234567812345678123456781
x       x       x       x       x   x   x       x       x       x

That is, the x's aren't aligned anymore.  In contrast, on a SunOS 5.10
machine, I get:

123456781234567812345678123456781   123456781234567812345678123456781
        x       x       x       x           x       x       x       x

Basically, SunOS pr notices, that it cannot print "\tx\tx\tx\tx"
anymore, since the separation between the pages messed that up. 
Instead it prints "\t     x\t     x\t     x\t     x".

This bug only occurs with certain page widths, obviously.  A first
workaround can be to use `-s` to separate both columns by tabs. 
Unfortunately, this only works as long as the line lengths actually
allow for the next column to start at a multiple of 8.  E.g., if I pass
`-w 132` as well, this won't work again -- again, SunOS does the
expected thing here.

This seems *kind* of related to multi-column merged output, as was
discussed some years ago here:
https://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00121.html

Unfortunately the POSIX spec is, in my reading, a bit unclear here. 
But I think the behavior of GNU/pr is rather unexpected when printing
multicolumn source code and not in line what the original authors
intended.

The outline of the fix would be to calculate the starting column
position and then re-tab.  In my case, I could workaround with the
following for now:

    $ pr -e -t test | pr -t -2 > out

What do you think?

~leo



$ pr --version
pr (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Pete TerMaat and Roland Huebner.
$ uname -a
Linux hoopyfrood 5.10.14-arch1-1 #1 SMP PREEMPT Sun, 07 Feb 2021
22:42:17 +0000 x86_64 GNU/Linux



















































--- End Message ---
--- Begin Message --- Subject: Re: bug#46422: [PATCH] Re: bug#46422: 'pr' screws up tabstops in multicolumn outpt? Date: Mon, 15 Feb 2021 21:33:03 +0000 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0
On 15/02/2021 07:19, Erik Auerswald wrote:
On Sun, Feb 14, 2021 at 11:04:21PM +0000, Pádraig Brady wrote:
On 14/02/2021 19:22, Erik Auerswald wrote:
May I ask you to test the new patch (v4) as well?

This version looks good.
I'll probably apply this after a little more local testing.

Pushed at:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.32-108-gbd6c97dee

Marking this as done.

thanks again,
Pádraig


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]