Jordan Williams [Mon, 22 Apr 2024 14:42:25 +0000 (09:42 -0500)]
meson: Add build-blockdev option
Only build blockdev on Linux.
The BLKROSET macro is used in blockdev.c from blkdev.h.
The blkdev.h header only defines this macro when it is missing on Linux.
Add blockdev to the list of executables, which appears to have been
omitted previously.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Wed, 24 Apr 2024 10:01:57 +0000 (12:01 +0200)]
Merge branch 'lsfd' of https://github.com/jwilk-forks/util-linux
* 'lsfd' of https://github.com/jwilk-forks/util-linux:
lsfd: (man) add commas between SEE ALSO items
lsfd: (man) fix license name
lsfd: (man) fix typos
Karel Zak [Mon, 22 Apr 2024 12:28:52 +0000 (14:28 +0200)]
lsns: fix netns use
# ip netns add vpn
# lsns -T -t net
Segmentation fault (core dumped)
The function interpolate_missing_namespaces() reads data from /proc.
However, in the case of a persistent namespace, there is no procfs
entry for the namespace. Therefore, this function should ignore it.
Fixes: https://github.com/util-linux/util-linux/issues/2982 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 22 Apr 2024 11:09:04 +0000 (13:09 +0200)]
libmount: Fix access check for utab in context
The function mnt_has_regular_utab() properly detects that the utab is
not writable, but this is ignored by the high-level context API. As a
result, the library later attempts to update the file and ends up with
a warning in mount(8):
$ mkdir sys
$ unshare --map-root-user --mount
$ mount --rbind /sys sys
$ umount --lazy sys; echo $?
umount: /home/user/sys: filesystem was unmounted, but failed to update userspace mount table.
16
In this case, the utab should be ignored.
Fixes: https://github.com/util-linux/util-linux/issues/2981 Signed-off-by: Karel Zak <kzak@redhat.com>
Thomas Weißschuh [Sun, 21 Apr 2024 18:00:31 +0000 (20:00 +0200)]
findmnt: always zero-terminate SOURCES data
libsmartcols expects it's data fields to be zero terminated.
See the call to strlen() in scols_column_greatest_wrap().
ul_buffer however does not guarantee that termination,
ul_buffer_append_strings() discard the zero-termination.
Always zero-terminate in get_data_col_sources() and drop the now
unnecessary variable "i".
Closes: https://github.com/util-linux/util-linux/issues/2980 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Karel Zak [Thu, 18 Apr 2024 07:42:25 +0000 (09:42 +0200)]
Merge branch 'meson-fix-build-ipcrm-option' of https://github.com/jwillikers/util-linux
* 'meson-fix-build-ipcrm-option' of https://github.com/jwillikers/util-linux:
meson: Require the seminfo type for ipcmk, ipcrm, and ipcs
meson: Add build-ipcmk option
meson: Add missing check for build-ipcrm option
Karel Zak [Wed, 17 Apr 2024 07:50:52 +0000 (09:50 +0200)]
Merge branch 'PR/libsmartcols-fix-wrap' of github.com:karelzak/util-linux-work
* 'PR/libsmartcols-fix-wrap' of github.com:karelzak/util-linux-work:
libsmartcols: (sample) add wrap repeating example
libsmartcols: reset wrap after calculation
Karel Zak [Tue, 16 Apr 2024 11:31:55 +0000 (13:31 +0200)]
libfdisk: add fdisk_ask_menu()
Currently, only libfdisk has the ability to prompt the user with a
menu. However, this functionality is not accessible through the public
library API. This commit exports this functionality through the use of
a simple function, fdisk_ask_menu().
Karel Zak [Tue, 16 Apr 2024 09:28:53 +0000 (11:28 +0200)]
Merge branch 'getwc' of https://github.com/t-8ch/util-linux
* 'getwc' of https://github.com/t-8ch/util-linux:
textutils: introduce and use fgetwc_or_err
treewide: use fgetc() instead of getc()
textutils: use fgetwc() instead of getwc()
Karel Zak [Tue, 16 Apr 2024 09:21:56 +0000 (11:21 +0200)]
Merge branch 'awk' of https://github.com/t-8ch/util-linux
* 'awk' of https://github.com/t-8ch/util-linux:
all_errnos/all_syscalls: don't hardcode AWK invocation
all_errnos/all_syscalls: don't warn during cleanup
all_errnos/all_syscalls: fail if any step fails
Karel Zak [Mon, 15 Apr 2024 07:07:12 +0000 (09:07 +0200)]
Merge branch 'lslocks--no-sleep-in-test-case' of https://github.com/masatake/util-linux
* 'lslocks--no-sleep-in-test-case' of https://github.com/masatake/util-linux:
lslocks: remove a unused local variable
lslocks: don't abort gathering per-process information even if opening a /proc/[0-9]* fails
Karel Zak [Mon, 15 Apr 2024 07:04:38 +0000 (09:04 +0200)]
Merge branch 'PR/autotools' of github.com:karelzak/util-linux-work
* 'PR/autotools' of github.com:karelzak/util-linux-work:
autotools: add --disable-enosys, check for linux/audit.h
autotools: check for sys/vfs.h and linux/bpf.h
Karel Zak [Mon, 15 Apr 2024 06:55:47 +0000 (08:55 +0200)]
Merge branch 'tinfo-disabler' of https://github.com/jwillikers/util-linux
* 'tinfo-disabler' of https://github.com/jwillikers/util-linux:
meson: Make ncurses dependency a disabler when not found
meson: Make tinfo dependency a disabler when not found
lsns: tolerate lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failing with ENOSYS
With the original code, "lsns/filedesc" test case failed on
"build (qemu-user, s390x)" and "build (qemu-user, riscv64)".
On the platforms, lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failed
with ENOSYS. The error stoped the iteration for gathering
information from /proc/[0-9]+. As a result, lsns printed
nothing. We don't expect this behavior.
Thomas Weißschuh [Sat, 13 Apr 2024 08:34:32 +0000 (10:34 +0200)]
textutils: introduce and use fgetwc_or_err
A return value of WEOF of fgetwc() can either mean end-of-file or an
error in errno. The error was ignored and interpreted as end-of-file.
Introduce a new helper that aborts on error and use it in text-utils.
This replaces all calls to plain fgetwc().
Closes #2909 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Sat, 13 Apr 2024 07:42:39 +0000 (09:42 +0200)]
Revert "lib/pager: Apply pager-specific fixes only when needed"
Less is not always detectable, as it can be hidden behind symlinks or
wrapper as for example in a default Debian installation.
Also testing for the literal string "less" does not match full path
specifications like "/usr/bin/less".
lslocks: don't abort gathering per-process information even if opening a /proc/[0-9]* fails
If a process ($pid) taking a lock is gone while running lslocks,
gathering per-process information for the process may fail in opening
/proc/$pid. Though lslocks should work with incomplete information,
the original code stopped gathering per-process information for the
other processes.
As a result of the original behavior, tests/ts/lslocks/lslocks really
failed in an environment where multiple test cases ran simultaneously.