In the 'greedy' mode strtok() skips leading white chars, but code for
-l (merge remaining data to the last column) do not count the skipped
chars.
Old version:
$ printf ' a b c\n1 2 3\n' | column -t -o '-' -l2
a-a
1-2 3
Fixed version:
$ printf ' a b c\n1 2 3\n' | column -t -o '-' -l2
a-b c
1-2 3
Note, see leading white chars ' a b c'.
Fexes: https://github.com/util-linux/util-linux/issues/1763
Signed-off-by: Karel Zak <kzak@redhat.com>
In version 2.38, exit-on-eof has been disabled by default. This change
is annoying for users and forces many users to use 'alias more="more
-e"'. It seems better to force POSIX lovers to use POSIXLY_CORRECT
env. variable and stay backwardly compatible by default.
Addresses: https://github.com/util-linux/util-linux/issues/1703
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2088493
Signed-off-by: Karel Zak <kzak@redhat.com>
This option affects list of visible columns, so it's better to apply
it before any other flags, because "-1" placeholder depends on visible
columns. For example:
echo "A B C D" | column --table --table-maxout --table-right -1 --table-hide 4
needs to hide column #4 (D) and align #3 (C) to the right.
Signed-off-by: Karel Zak <kzak@redhat.com>
The command 'echo | more -s' ends in infinite loop if exit-on-EOF is
disabled (default now). We need to call more_key_command() to ask for
user's reaction.
Fixes: https://github.com/util-linux/util-linux/issues/1669
Signed-off-by: Karel Zak <kzak@redhat.com>
The "--table-hide -" hides all unnamed columns, but this does not work
for JSON output. This patch fixes this issue.
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'manpage-fixes' of https://github.com/mariobl/util-linux:
Fix several adoc files as reported by Helge Kreutzmann
eject.1.adoc: Fix markup
colors.adoc: format command name bold
Add missing *.adoc files to Makemodule.am
Add help-version.adoc to po4a configuration file
Add new *.adoc files to po4a configuration file
Fix markup and wording in colors.adoc
* use man-common/colors.adoc include file
* improve description and add example how to disable colors globally
or for specific tool
Addresses: https://github.com/util-linux/util-linux/issues/1593
Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola pointed out that /proc contains files with zero size but
content in ec4153cc28.
Eventually fixes for better type handling have been committed with
ba105bb5eb and error handling when "more"
is called with directories in 32a4efc567.
This commit fixes a regression and wrong file size handling:
checkf ends execution prematurely if st.st_size is 0. The idea was to
skip the check_magic call which would otherwise claim that a text file
would not be one, e.g. /proc/self/wchan would fail otherwise. This has
two consequences:
1. The last check in checkf is never true, because if st_size is 0 we
already left the function (file_size and st_size are both off_t).
Proof of Concept (use a window with less lines than /proc/cpuinfo):
$ echo "hello world" > /tmp/more-poc
$ more /tmp/more-poc /proc/cpuinfo
- Press space to switch to next file
- You see >100% in status line
2. Leaving early does not set the close on exit flag for empty files.
3. Since the last line is never reached, ~(off_t)0 is never set, which
implies that the check in display_file is never true.
The st.st_size = 0 case is supposed to be special. Simplify this
regression fix by considering ctl->file_size = 0 to be special. This
eleminates the ~(off_t)0 magic, which would be -1.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
When a quit character is seen, immediately return that command, as it is the correct operation to perform in this case.
A bigger fix is needed here, in that we need to have a *queue* of operations to perform, rather than a single one
The command allows executing arbitrary shell commands while viewing a file by
entering '!' followed by the command. Entering a command that contains a '%',
'!', or '\' causes a segmentation violation.
The same more(1) function has a problem when not file is specified (cat
/etc/passwd | more) on command line.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1975153
Signed-off-by: Karel Zak <kzak@redhat.com>
The rule is pretty simple, always use setgid() before setuid().
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>