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>
We already have mbs_safe_nwidth() but it assumes that all "bad" chars
will be encoded by \x<hex>. Now we need also function that do not care
about encoding.
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'clang' of https://github.com/neheb/util-linux:
[clang-tidy] fix misleading identation
[clang-tidy] use ceil
[clang-tidy] fix wrong *cmp usage
[clang-tidy] do not use else after return
[clang-tidy] do not return in void functions
[clang-tidy] fix mismatching declarations
* 'map-user' of https://github.com/mat8913/util-linux:
unshare: Support names for map-user/group options
lib/pwdutils: add xgetgrnam
unshare: allow custom uid/gid mappings in userns
The --map-user and --map-group options can now be specified by either
uid/gid or user/group name.
Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
Update blkdiscard manual page. Length and offset values must be aligned
to the device sector size.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
* '2020wk13' of https://github.com/kerolasa/util-linux:
include: add remove_entry() to env.h
tests: add sanitize_env() check
more: fix moving backwards so that it can reach begining of the file
more: use getopt_long() to parse options
more: remove underlining related code
more: fix SIGSTOP and SIGCONT handling
more: make execute() more robust and timely
more: target all standard streams when calling fflush()
more: remove kill_line() in favor of erase_prompt()
more: avoid defining special characters locally
more: use off_t and cc_t to clarify what variables attempt to represent
more: do not reset parent process terminal in execute()
more: use single exit path to ensure resource freeing is unified
This PR fixes an off by one in `strncmp(dev->bid_name, "/dev/mapper/", 11)` check. The `"/dev/mapper/"` string literal has a length of 12 and without this fix paths like `"/dev/mapperSOMETHING"` would also be accepted.
Moving backwards has worked fine until reaching start of file. At that
point more printout had one line too much in output causing more seemingly
never to be able to reach the start. That is now fixed, with clean ups to
skip_backwards() making it less confusing.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit also includes fix to how initial skip lines and search are
instructed in the code. Earlier version was pretty close impossible to make
work with getopt_long() and had minor flaw - if both initial skip lines and
search were defined at the same time the skipping did not happen. That is
now corrected.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
When suspending only the more process. Sending signal to process group
makes signal destination unnecessarily vague. After the suspend is over
SIGCONT is expected, and it needs to ensure output terminal settings are
what more needs.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The wait() is now a little more robust by being more tolerate rogue SIGCHLDs
and unblocked signals. The repeated fork() and sleep() is removed, if first
try does not success give up without delay to provide user timely feedback.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
If streams need to be flushed do not try to be clever, just flush all of
them. That lead to finding unnecessary print out in run_shell() that is
removed in this commit.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The sys/ttydefaults.h can be used for CTRL() and rubout that is CERASE. For
alarm it's best to keep things simple and call printf() alarm modifier.
QUIT was not in use, so it is just deleted.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
As a minor robustness improvement use ftello() to find out file position
rather than add and substract from old value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Two new options are added: `--map-user=<uid>` and `--map-group=<gid>`
for custom user and group mappings respectively. These are just
generalizations of the existing `--map-root-user` and
`--map-current-user` options.
As a side effect of this commit, specifying both `--map-root-user` and
`--map-current-user` no longer causes an error. Instead, the last
occurrence takes precedence.
Addresses: https://github.com/karelzak/util-linux/issues/885
Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
A user who wants to change the niceness of a process is likely to also be
interested in changing the scheduler class and/or RT priority.
Signed-off-by: Jann Horn <jannh@google.com>
Currently, umount /foo results in a statfs("/foo") call, which triggers
autofs. This can create another mountpoint on /foo, which is then unmounted
later instead of the actual /foo at the time umount was called.
This is especially an issue for umount -R /bar, which just fails with
-EBUSY as the accidental mountpoint is never accounted for and so it tries
to umount /bar before /bar/someautofs.
Replace the direct statfs call with open(path, O_PATH) + fstatfs, which sees
the autofs mount directly, without triggering it.
It seems the 'alias' attribute is not portable enough.
libuuid/src/unparse.c:72:17: error: only weak aliases are supported on darwin
__attribute__((alias("uuid_unparse_lower")));
Signed-off-by: Karel Zak <kzak@redhat.com>
There is seven values but only 6 spaces between them, that why the -1
The value is always used with a minus one, just set it correctly instead
of always fix when used
Signed-off-by: Aurelien LAJOIE <orel@melix.net>
There is 2 improvements:
* remove useless uuid_unpack,
* directly print the hexa format from memory without using printf
we can do this as the bytes order is the network byte order
https://tools.ietf.org/html/rfc4122#section-4.1.2
even the spatially unique node identifier(the last 6 bytes)
The improvement is important, some results for 1000000 uuid_unparse calls:
Little Endian Ubuntu:
before took 382623 us
after took 36740 us
Big Endian OpenBSD:
before took 3138172 us
after took 180116 us
Signed-off-by: Aurelien LAJOIE <orel@melix.net>
* 'more' of https://github.com/kerolasa/util-linux:
more: refactor and clarify code
more: add display_file() to show files and stdin
more: simplify initterm()
more: move currently open file to control structure
more: move code blocks from more_key_command() to functions
more: move runtime usage output to a function
more: restructure print_buf() if-else with continue
more: tell in run time help what the 'v' will execute as editor
more: drop setuid permissions before executing anything
more: do not allocate shell command buffer from stack
more: replace siglongjmp() and signal() calls with signalfd()
* '2020wk12' of https://github.com/kerolasa/util-linux:
lslogins: use lastlog as wtmp fallback
login: avoid lseek() with pread() and pwrite()
libuuid: ensure variable is initialized [cppcheck]
ctrlaltdel: display error message indicated by errno