Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Remigiusz Leon Suwalski <remigiusz.suwalski@protonmail.ch>
To: "util-linux@vger.kernel.org" <util-linux@vger.kernel.org>
Subject: Piped `column -t` inserts extra newlines since Oct 2023
Date: Mon, 04 Dec 2023 17:26:05 +0000	[thread overview]
Message-ID: <StZBjLc2hfwARaOlTwkjpnqrtWLLL_rya0UmGRk5OFwX1Y1KthwQWBz5bcDpEOjcq2hbJ6aY4fcoAMU3pU2spFhGDbGwmd4puAzNrvspFpE=@protonmail.ch> (raw)

Hi,
I have discovered that `column` utility behaves oddly when piped to another command, as shown on examples below. I am not sure whether this is a bug or intended behaviour.

First `column` built from sources (commit https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=94feb5a20d23904cc15cd857c4e00f35f495116c):
$ echo '_ __ ___ ________ __________ ________' | ./column -t | nl # strange
1  __
2     ___
3          ___
4                 _________
5                                       __________
6                                                                  _______
$ echo '_ __ ___ ________ __________ ________' | ./column -t > file.txt # the same issue as above
$ echo '_ __ ___ ________ __________ ________' | ./column -t # expected
_  __  ___  ________  __________  ________

A workaround that works sometimes (on this and some other but not all inputs) is to pass -c 0 option:
$ echo '_ __ ___ ________ __________ ________' | ./column -t -c 0 | nl # expected
1 _  __  ___  ________  __________  ________

Separate binary built from parent commit 3949a48dd1351cea7c523fe97666190359247630 behaves well:

$ echo '_ __ ___ ________ __________ ________' | ./column -t | nl
1 _  __  ___  ________  __________  ________

If it matters, the output of "tput cols" command is 252, operating system is Ubuntu 22.04.3 and my locale is as follows:
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=

Best regards,
Leon Suwalski

             reply	other threads:[~2023-12-04 17:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 17:26 Remigiusz Leon Suwalski [this message]
2023-12-05 10:26 ` Piped `column -t` inserts extra newlines since Oct 2023 Karel Zak
2023-12-05 11:22   ` Remigiusz Leon Suwalski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='StZBjLc2hfwARaOlTwkjpnqrtWLLL_rya0UmGRk5OFwX1Y1KthwQWBz5bcDpEOjcq2hbJ6aY4fcoAMU3pU2spFhGDbGwmd4puAzNrvspFpE=@protonmail.ch' \
    --to=remigiusz.suwalski@protonmail.ch \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).