Old:
$ echo -e "$(tput smul)A$(tput rmul) B\nC D" | column --table
A B
C D
Fixed:
$ echo -e "$(tput smul)A$(tput rmul) B\nC D" | ./column --table
A B
C D
Addresses: https://github.com/karelzak/util-linux/issues/1011
Signed-off-by: Karel Zak <kzak@redhat.com>
The logger and rtwake time function changes continue the same fixes as
previous commit - use thread safe functions. The libsmartcols condition
removal is possible because width must be greater than tb->termwidth that is
size_t and cannot be smaller than zero. And remove couple FIXME's that are
old and unlikely ever to get fixed.
Reference: 3160589d86
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Now we implement the same thing on more places. Let's add one set of
functions to walk the tree and use it everywhere.
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/grouping.c:115:26: warning: declaration of ‘ln’ shadows a
previous local [-Wshadow]
libsmartcols/src/grouping.c:108:24: note: shadowed declaration is here
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For some use-case we need to describe M:N relation between output
lines. The nice examples are RAIDs or multi-path devices in lsblk
output.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 955.7M 0 loop
┌┈▶ ├─test-thin-metadata 253:0 0 2M 0 dm
└┬▶ └─test-thin-data 253:1 0 953.7M 0 dm
└┈┈test-thin-pool 253:2 0 953.7M 0 dm
In this example two line (test-thin-metadata and test-thin-data) are
parents for another line (test-thin-pool). The new API uses term "group"
for parental line -- the number of group members is unlimited and every
group has at least one child.
It's possible that group's child is member of another group:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 955.7M 0 loop
┌┈▶ ├─test-thin-metadata 253:0 0 2M 0 dm
└┬▶ └─test-thin-data 253:1 0 953.7M 0 dm
┌┈▶ └┈┈test-thin-pool 253:2 0 953.7M 0 dm
┆ └─test-thin 253:3 0 190.8M 0 dm
└┬▶ loop1 7:1 0 190.8M 0 loop
└┈┈┈┈┈test-thin-extsnap 253:4 0 190.8M 0 dm
For now multi-group relation is unsupported and one line can be member
of one group only. The library API and printing code is ready to
support this feature, but not sure if we really need it. All what is
necessary is to create array of groups in the line struct.
Note that grouping is independent on standard parent->child relations
between lines and grouping can connect arbitrary lines. The
restriction is only that group child cannot be child of another line
or child of another group. These cross reference are (and probably
will be) impossible.
The patch is relative large, but easy to review. Changes:
* add new UTF symbols
* add scols_symbols_set_group_* public API to modify new symbols
* add struct libscols_group, used only internally
* add "grpset" array to table struct -- the array is used to keep
position of the group in the output. Every active group uses three
items in the grpset. If there is more overlapping groups than bigger
grpset is allocated.
Signed-off-by: Karel Zak <kzak@redhat.com>
The columns with NOEXTREME flag are internally marked as extreme
(=contains extreme width) if maximal with is greater than 2 *
average_width. This detection has to sure that the average is non-zero
otherwise the column is always "extreme".
Signed-off-by: Karel Zak <kzak@redhat.com>
The table allows to add columns on the fly when lines already exist.
So, it does not make sense to reject request to add line to table
without columns.
Signed-off-by: Karel Zak <kzak@redhat.com>
Let's use standardized names for licenses. The names used by SPDX
makes things more obvious at first glance. For complete list see:
https://spdx.org/licenses/
Note, this commit does not change any license or so...
Signed-off-by: Karel Zak <kzak@redhat.com>
The commit 0f9f927b6f forces
libsmartcols to use one byte as a minimal column width. This seems
like a bug if the column is empty and without header.
$ printf '🅰️b\n' | column -t -s ':' -o ':'
🅰️b
Fixed version:
$ printf '🅰️b\n' | column -t -s ':' -o ':'
🅰️b
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'maybe-for-v2.32' of https://github.com/rudimeier/util-linux:
tests: use pgrep instead of ps --ppid ...
misc: fix typos using codespell
lsns: fix clang compiler warning
tests: add udevadm settle to sfdisk/resize
build-sys: disable bz2 tarball and fix some am warnings
[kzak@redhat.com: - it's possible that column has zero width when
minimal width is reduced due to very small terminal. In this case
make sure that we do not use such column at all.]
Signed-off-by: Karel Zak <kzak@redhat.com>
The default is to use header width or relative width setting as the
minimal column width. The problem are columns where is no header or
relative width. Let's set minimal width to 1 in this case.
Addresses: https://github.com/karelzak/util-linux/pull/577
Signed-off-by: Karel Zak <kzak@redhat.com>
The command
$ column -t -W2 -c11 <<< "cat dog bird"
causes finite loop, because there is no minimal column width (missing
header). The print functions should be robust enough to return -EINVAL
when nonsense is requested.
Addresses: https://github.com/karelzak/util-linux/pull/577
Signed-off-by: Karel Zak <kzak@redhat.com>
We have already automakes's automatic dependencies like
bla.h.in -> bla.h -> foo.o -> bar.la
An explicit direct dependency bla.h.in -> bar.la
is redundant and useless anyways.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>