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
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
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.
Karel Zak [Thu, 7 Dec 2023 12:54:26 +0000 (13:54 +0100)]
unshare: make sure map_range.next is initialized [coverity scan]
* initialize during declaration (if possible), unspecified fields
defaults to zero in this case.
* fix coverity warnings:
CID 410290: Uninitialized variables (UNINIT)
Using uninitialized value "mid". Field "mid.next" is uninitialized when calling "insert_map_range".
CID 410289: Uninitialized variables (UNINIT)
Using uninitialized value "hi". Field "hi.next" is uninitialized when calling "insert_map_range".
CID 410288: Uninitialized variables (UNINIT)
Using uninitialized value "lo". Field "lo.next" is uninitialized when calling "insert_map_range".
Karel Zak [Thu, 7 Dec 2023 10:30:26 +0000 (11:30 +0100)]
Merge branch 'master' of https://github.com/mystuffs/util-linux
* 'master' of https://github.com/mystuffs/util-linux:
lscpu-cputype.c: assign value to multiple variables (ar->bit32 and ar->bit64) clang with -Wcomma will emit an warning of "misuse of comma operator". Since the value that will be assigned, is the same for both (bit32 and bit64), just assigning directly to both variables seems reasonable.
Karel Zak [Wed, 6 Dec 2023 11:26:39 +0000 (12:26 +0100)]
lslocks: cleanup --list-columns
* remove "Available columns" from --help
* remove dependence on command-line options order ("-H -J" vs. "-J -H")
* remove global variable shadowing for 'raw' and 'json'
* keep --list-columns in "help & version block" in usage() output
References: https://github.com/util-linux/util-linux/pull/2602 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 6 Dec 2023 10:59:37 +0000 (11:59 +0100)]
Merge branch 'list-columns-options' of https://github.com/masatake/util-linux
* 'list-columns-options' of https://github.com/masatake/util-linux:
lslocks: add -H option printing avaiable columns
lslocks: (refactor) add a helper function returning JSON type for a given column
lslocks: (fix) set JSON type for COL_SIZE even when --bytes is specified
lsfd: use helper functions in column-list-table.h
add helper functions for implementing -H/--list-columns option
rilysh [Wed, 6 Dec 2023 05:21:27 +0000 (00:21 -0500)]
lscpu-cputype.c: assign value to multiple variables (ar->bit32 and ar->bit64)
clang with -Wcomma will emit an warning of "misuse of comma operator".
Since the value that will be assigned, is the same for both (bit32 and bit64),
just assigning directly to both variables seems reasonable.
Karel Zak [Tue, 5 Dec 2023 12:52:03 +0000 (13:52 +0100)]
Merge branch 'fixes' of https://github.com/t-8ch/util-linux
* 'fixes' of https://github.com/t-8ch/util-linux:
build: use -std=c99 and -std=c++11 by default
coverage.h: mark _exit as noreturn
lsfd: switch to c99-conformant alignment specification
blkdev.h: avoid some unused argument warnings
m4: update pkg.m4
include/c.h: implement reallocarray
libblkid: avoid use of non-standard typeof()
meson: bump required version to 0.60.0
Karel Zak [Tue, 5 Dec 2023 10:09:38 +0000 (11:09 +0100)]
Merge branch 'PR/libmount-utab-external' of github.com:karelzak/util-linux-work
* 'PR/libmount-utab-external' of github.com:karelzak/util-linux-work:
tests: make mount/special more robust
tests: add missing file and improve options-missing test
libmount: test utab options after helper call
libmount: add missing utab options after helper call
libmount: add private mnt_optstr_get_missing()
Karel Zak [Tue, 5 Dec 2023 10:08:57 +0000 (11:08 +0100)]
Merge branch 'unshare-maps' of https://github.com/arachsys-prs/util-linux
* 'unshare-maps' of https://github.com/arachsys-prs/util-linux:
unshare: Add --map-users=all and --map-groups=all
unshare: Set uid and gid maps directly when run as root
unshare: Support multiple ID ranges for user and group maps
Chris Webb [Mon, 4 Dec 2023 18:15:14 +0000 (18:15 +0000)]
unshare: don't try to reset the disposition of SIGKILL
If the child process is killed with SIGKILL, don't attempt to reset the
disposition of SIGKILL (which can't be caught or ignored anyway) before
self-signalling. This caused a misleading 'sigprocmask unblock failed'
error instead of dying with the same SIGKILL status as the child.
Fixes: https://github.com/util-linux/util-linux/issues/2614 Signed-off-by: Chris Webb <chris@arachsys.com>
Khem Raj [Mon, 4 Dec 2023 03:59:46 +0000 (19:59 -0800)]
login-utils: include libgen.h for basename API
musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
include libgen.h for using the posix declaration of the funciton.
Fixes
../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
847 | shell_basename = basename(shell);
| ^
Thomas Weißschuh [Thu, 30 Nov 2023 22:24:37 +0000 (23:24 +0100)]
build: use -std=c99 and -std=c++11 by default
Relying on the compiler default is problematic:
* New constructs may be introduced accidentally that break backwards
compatibility.
* Older compilers may default to a more restricted standard than the
codebase is actually developed with.
Explicitly select C99 (and C++11 for the fuzzing part).
Autotools does not want to default to C99, so set it explcitly during
CI.