Karel Zak [Thu, 4 Jan 2024 10:51:40 +0000 (11:51 +0100)]
Merge branch 'wipefs/improvements' of https://github.com/t-8ch/util-linux
* 'wipefs/improvements' of https://github.com/t-8ch/util-linux:
wipefs: allow storage of backups in specific location
wipefs: (tests) remove necessity of root permissions
Karel Zak [Thu, 4 Jan 2024 10:50:19 +0000 (11:50 +0100)]
Merge branch 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work
* 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work:
Dividing tests into subtest based on recommendation from review
util-linux/sys-utils test dmesg support for additional human-readable timestamp
dmesg: man and coding style changes
dmesg: support for additional human readable timestamp
Karel Zak [Tue, 2 Jan 2024 10:15:57 +0000 (11:15 +0100)]
Merge branch 'fixes' of https://github.com/t-8ch/util-linux
* 'fixes' of https://github.com/t-8ch/util-linux:
libmount: (context) avoid dead store
libmount: (utils) avoid dead store
pipesz: avoid dead store
fileeq: optimize size of ul_fileeq_method
sha1: properly wipe variables
libfdisk: (sgi): use strncpy over strcpy
libfdisk: (sun) properly initialize partition data
libmount: (tests) fix --filesystems crash on invalid argument
libmount: (tests) fix --filesystems test argument parsing
libmount: (veritydev) use asprintf to build string
libsmartcols: (samples/fromfile) properly handle return value from getline()
libuuid: (test_uuid) make reading UUIDs from file more robust
libblkid: (dev) use strdup to duplicate string
pg: use snprintf to build string
hexdump: use xasprintf to build string
readprofile: use xasprintf to build string
cal: avoid out of bound write
logger: use strncpy instead of strcpy
exec_shell: use xasprintf
strv: make strv_new_api static
Karel Zak [Sun, 31 Dec 2023 10:23:39 +0000 (11:23 +0100)]
Merge branch 'patch-12' of https://github.com/mariobl/util-linux
* 'patch-12' of https://github.com/mariobl/util-linux:
Update po4a.cfg to assign exch.1 correctly to misc-utils
exch: Add man page to po4a.cfg to make it translatable
Rishabh Thukral [Sat, 23 Dec 2023 23:13:36 +0000 (15:13 -0800)]
util-linux/sys-utils test dmesg support for additional human-readable timestamp
This commit adds tests for new functionality in dmesg to support multiple timestamp formats.
The user can specify multiple timestamp formats with --time-format option and dmesg prints all the logs with desired timestamp formats in the sequence of user-provided formats.
This test verifies that output contains multiple formats in the sequence of input and it also tests for the special case where the user specifies delta format along with either ctime or raw.
Karel Zak [Thu, 14 Dec 2023 08:43:54 +0000 (09:43 +0100)]
Merge branch 'PR/libsmartcols-cell-data' of github.com:karelzak/util-linux-work
* 'PR/libsmartcols-cell-data' of github.com:karelzak/util-linux-work:
libsmartcols: fix memory leak on filter parser error
libsmartcols: free after error in filter sample
libsmartcols: make cell data printing more robust
Rishabh Thukral [Tue, 5 Dec 2023 19:53:33 +0000 (11:53 -0800)]
dmesg: support for additional human readable timestamp
The dmesg logs have timestamps in seconds since boot format which can
be converted to other formats. However, there is no option to include
both the original timestamp as present in the buffer along with the
converted timestamp in the specified format.
This change updates the --time-format option in dmesg to enable the
user to specify it multiple times with different formats with each
input providing a timestamp format among the currently supported
choices. This enables seeing the dmesg logs in both seconds since boot
and human readable format simultaneously in each row of the log output.
The sequence of timestamp format follows the order
in which the user provides the desired formats.
Karel Zak [Tue, 12 Dec 2023 09:21:19 +0000 (10:21 +0100)]
Merge branch 'dmesg/tests' of https://github.com/t-8ch/util-linux
* 'dmesg/tests' of https://github.com/t-8ch/util-linux:
dmesg: use symbolic defines for second conversions
dmesg: add support for reserved and local facilities
dmesg: (tests) validate json output
dmesg: only write one message to json
jsonwrt: add ul_jsonwrt_value_s_sized
dmesg: open-code LOG_MAKEPRI
dmesg: correctly print all supported facility names
dmesg: error out instead of silently ignoring force_prefix
Karel Zak [Mon, 11 Dec 2023 09:52:11 +0000 (10:52 +0100)]
Merge branch 'fix-bash-completion-rules' of https://github.com/masatake/util-linux
* 'fix-bash-completion-rules' of https://github.com/masatake/util-linux:
bash-completion: (lslocks): add --bytes option to the rules
bash-completion: (fadvise): fix a typo
more: exit if POLLERR and POLLHUP on stdin is received
more command continues to run in case stdin have closed the file and it
takes 100% of CPU. This is because revents on stdin send
POLLIN | POLLHUP | POLLERR once stdin is closed. more receives it even
though it is not requested in events. This is common Linux behaviour to
never mask out POLLHUP or POLLERR. The loop in more_key_command() runs
infinitely because more_poll() returns 0 and read_command() reads 0
bytes.
Check for POLLERR and POLLHUP, and exit more in case of an error.
Steps to reproduce:
1. Setup /etc/systemd/logind.conf with KillUserProcesses=no
2. Add config "Defaults use_pty" in /etc/sudoers
3. Start an ssh session to the machine
4. # sudo su -
5. # more <big enough file>
6. kill the parent ssh process, say close the tab
At this time "more" runs with 100% CPU utilization.
Eli Schwartz [Thu, 7 Dec 2023 00:40:44 +0000 (19:40 -0500)]
bash-completion: make sure that "lastb" actually completes
Building util-linux logs a warning on Gentoo:
```
* Problems with installed bash completions were found:
*
* lastb: incorrect name, no completions for 'lastb' command defined.
*
* For more details on installing bash-completions, please see:
* https://wiki.gentoo.org/wiki/Bash/Installing_completion_files
```
A bash-completion file is usually composed of two parts:
- a function that knows how to produce completions
- a specification of which command should be completed
In cases where multiple commands have the same options, e.g. commands
that are symlinked to each other, it is common to symlink the completion
files as well. This shares the first part. But the second part cannot be
shared, it must be implemented twice by specifying two different
commands to be completed.
"lastb" had a symlinked completion, but when the completion system
processes /usr/share/bash-completion/completions/lastb, it would only
define a completion for "last".
Define both completions in one file, so that sourcing it works
regardless of command used.
more: exit if POLLHUP or POLLERR on stdin is received
more command continues to run in case stdin have closed the file and it
takes 100% of CPU. This is because revents on stdin send
POLLIN | POLLHUP | POLLERR once stdin is closed. more receives it even
though it is not requested in events. This is common Linux behaviour to
never mask out POLLHUP or POLLERR. The loop in more_key_command() runs
infinitely because more_poll() returns 0 and read_command() reads 0
bytes.
Steps to reproduce:
1. Setup /etc/systemd/logind.conf with KillUserProcesses=no
2. Add config "Defaults use_pty" in /etc/sudoers
3. Start an ssh session to the machine
4. # sudo su -
5. # more <big enough file>
6. kill the parent ssh process, say close the tab
At this time "more" runs with 100% CPU utilization.
Masatake YAMATO [Thu, 7 Dec 2023 19:35:29 +0000 (04:35 +0900)]
tests: (lslcoks) insert a sleep between taking a lock and running lslocks
Close #2624.
It appears that there is a time lag between locking and its visibility
in /proc/locks. See the unstbale results of errors I observed in
https://github.com/util-linux/util-linux/pull/2629.