]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
33 min agoMerge branch 'testcoverage_sh_find_shared_tsdirs' of https://github.com/cgoesche... master
Karel Zak [Mon, 10 Aug 2026 11:47:24 +0000 (13:47 +0200)] 
Merge branch 'testcoverage_sh_find_shared_tsdirs' of https://github.com/cgoesche/util-linux-fork

* 'testcoverage_sh_find_shared_tsdirs' of https://github.com/cgoesche/util-linux-fork:
  tests: (minix) make long options visible for test coverage analysis
  tests: (fsck.cramfs) make long options visible for test coverage analysis
  tools: (testcoverage.sh) find shared test directories

2 hours agoMerge branch 'use_time_unit_macros' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 10 Aug 2026 09:47:27 +0000 (11:47 +0200)] 
Merge branch 'use_time_unit_macros' of https://github.com/cgoesche/util-linux-fork

* 'use_time_unit_macros' of https://github.com/cgoesche/util-linux-fork:
  tree: use time unit macros for conversions

36 hours agotests: (minix) make long options visible for test coverage analysis
Christian Goeschel Ndjomouo [Sat, 8 Aug 2026 23:43:46 +0000 (19:43 -0400)] 
tests: (minix) make long options visible for test coverage analysis

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
36 hours agotests: (fsck.cramfs) make long options visible for test coverage analysis
Christian Goeschel Ndjomouo [Sat, 8 Aug 2026 23:28:22 +0000 (19:28 -0400)] 
tests: (fsck.cramfs) make long options visible for test coverage analysis

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
36 hours agotools: (testcoverage.sh) find shared test directories
Christian Goeschel Ndjomouo [Sat, 8 Aug 2026 23:25:01 +0000 (19:25 -0400)] 
tools: (testcoverage.sh) find shared test directories

Some programs share a common test directory whose name
differs from the program names and made it so that we
could not find the tools' test scripts. Adding a hash
table that contains the names of exceptional programs
and their actual test directory makes it easy to find
what we need.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 days agotree: use time unit macros for conversions
Christian Goeschel Ndjomouo [Fri, 7 Aug 2026 02:33:04 +0000 (22:33 -0400)] 
tree: use time unit macros for conversions

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 days agoMerge branch 'test_mkfds--use-libsmartcols' of https://github.com/masatake/util-linux
Karel Zak [Thu, 6 Aug 2026 15:44:47 +0000 (17:44 +0200)] 
Merge branch 'test_mkfds--use-libsmartcols' of https://github.com/masatake/util-linux

* 'test_mkfds--use-libsmartcols' of https://github.com/masatake/util-linux:
  test_mkfds: use libsmartcols in -W, --multiplexers output
  test_mkfds: use libsmartcols in -O, --output-values output
  test_mkfds: use libsmartcols in -I, --parameters output
  test_mkfds: use libsmartcols in -l, --list output

4 days agotest_mkfds: use libsmartcols in -W, --multiplexers output
Masatake YAMATO [Thu, 23 Jul 2026 20:37:00 +0000 (05:37 +0900)] 
test_mkfds: use libsmartcols in -W, --multiplexers output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 days agotest_mkfds: use libsmartcols in -O, --output-values output
Masatake YAMATO [Fri, 9 Jan 2026 18:00:43 +0000 (03:00 +0900)] 
test_mkfds: use libsmartcols in -O, --output-values output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 days agotest_mkfds: use libsmartcols in -I, --parameters output
Masatake YAMATO [Thu, 4 Sep 2025 09:38:54 +0000 (18:38 +0900)] 
test_mkfds: use libsmartcols in -I, --parameters output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 days agotest_mkfds: use libsmartcols in -l, --list output
Masatake YAMATO [Thu, 4 Sep 2025 09:13:44 +0000 (18:13 +0900)] 
test_mkfds: use libsmartcols in -l, --list output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 days agoMerge branch 'PR/minix-overflow-fixes' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 6 Aug 2026 09:00:26 +0000 (11:00 +0200)] 
Merge branch 'PR/minix-overflow-fixes' of https://github.com/karelzak/util-linux-work

* 'PR/minix-overflow-fixes' of https://github.com/karelzak/util-linux-work:
  fsck.minix, mkfs.minix: fix integer overflows on 32-bit builds

4 days agoMerge branch 'fix-erofs-minix-probe' of https://github.com/craftyguy/util-linux
Karel Zak [Thu, 6 Aug 2026 08:17:03 +0000 (10:17 +0200)] 
Merge branch 'fix-erofs-minix-probe' of https://github.com/craftyguy/util-linux

* 'fix-erofs-minix-probe' of https://github.com/craftyguy/util-linux:
  libblkid: minix: don't detect erofs images as minix

4 days agoMerge branch 'lsfd/io_uring' of https://github.com/echoechoin/util-linux
Karel Zak [Thu, 6 Aug 2026 07:53:19 +0000 (09:53 +0200)] 
Merge branch 'lsfd/io_uring' of https://github.com/echoechoin/util-linux

* 'lsfd/io_uring' of https://github.com/echoechoin/util-linux:
  tests: (lsfd) add mkfds-io_uring test case
  test: (mkfds::io_uring) new factory
  lsfd: introduce io_uring anon-inode support
  include/strutils: add parse helpers for struct members

4 days agolibblkid: minix: don't detect erofs images as minix
Clayton Craft [Wed, 5 Aug 2026 22:22:56 +0000 (15:22 -0700)] 
libblkid: minix: don't detect erofs images as minix

The erofs superblock starts at 0x400, the same offset as the minix
superblock, and its inode count field overlaps the offset where minix
keeps its magic. An erofs image that has an inode count which happens
to equal the minix magic can be incorrectly reported as containing both
filesystems, and probe fails with an ambivalent result. This can lead to
e.g. so udev failing to create by-partuuid symlink for the partition.

This reject a minix match when the erofs magic is present at 0x400, the
same way an ext superblock is already handled in probe_minix.

Fixes: #4529
4 days agofsck: free compiled fs types list
lijian [Tue, 21 Jul 2026 09:26:43 +0000 (17:26 +0800)] 
fsck: free compiled fs types list

The fs_type_compiled structure allocated by compile_fs_type() was not
freed before program exit, resulting in a minor memory leak. Add
free_fs_type_compile() to release the memory properly.

[karelzak@redhat.com: fix indentation]

Signed-off-by: lijian <lijian01@kylinos.cn>
Signed-off-by: Karel Zak <karelzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agocfdisk: move subwin() after scols_print_table_to_string() check
Karel Zak [Wed, 5 Aug 2026 16:14:33 +0000 (18:14 +0200)] 
cfdisk: move subwin() after scols_print_table_to_string() check

Move subwin() call after the scols_print_table_to_string() error
check to avoid creating a window that would be leaked on the error
path. Also add a NULL check for the subwin() result itself.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agoMerge branch 'branch-02' of https://github.com/Leefancy/util-linux
Karel Zak [Wed, 5 Aug 2026 16:04:12 +0000 (18:04 +0200)] 
Merge branch 'branch-02' of https://github.com/Leefancy/util-linux

* 'branch-02' of https://github.com/Leefancy/util-linux:
  cfdisk: check scols_print_table_to_string output

5 days agocfdisk: check scols_print_table_to_string output
lijian [Mon, 20 Jul 2026 09:39:46 +0000 (17:39 +0800)] 
cfdisk: check scols_print_table_to_string output

Signed-off-by: lijian <lijian01@kylinos.cn>
5 days agotests: (lsfd) add mkfds-io_uring test case
WanBingjiang [Fri, 31 Jul 2026 03:42:15 +0000 (11:42 +0800)] 
tests: (lsfd) add mkfds-io_uring test case

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 days agoMerge branch 'dlopen' of https://github.com/bluca/util-linux
Karel Zak [Wed, 5 Aug 2026 08:57:05 +0000 (10:57 +0200)] 
Merge branch 'dlopen' of https://github.com/bluca/util-linux

* 'dlopen' of https://github.com/bluca/util-linux:
  tools: switch libeconf to runtime optional via dlopen
  tools: switch libsystemd to runtime optional via dlopen
  build: fix build with binutils < 2.36
  lib/dl-utils: fix build on alpha

5 days agotest: (mkfds::io_uring) new factory
WanBingjiang [Fri, 31 Jul 2026 03:42:12 +0000 (11:42 +0800)] 
test: (mkfds::io_uring) new factory

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 days agolsfd: introduce io_uring anon-inode support
WanBingjiang [Fri, 31 Jul 2026 03:42:09 +0000 (11:42 +0800)] 
lsfd: introduce io_uring anon-inode support

Parse io_uring fdinfo to expose SQ/CQ ring state, registered
buffers/files, SQ poll thread info, and NAPI mode via dedicated
IO-URING.* columns.

Note that the io_uring NAME format is used only for opened file
objects, not for mapped ones.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 days agoinclude/strutils: add parse helpers for struct members
WanBingjiang [Wed, 5 Aug 2026 02:17:10 +0000 (10:17 +0800)] 
include/strutils: add parse helpers for struct members

Add ul_strtou32_to_offset()/ul_strtou32_to_struct_member() and
ul_strtos32_to_offset()/ul_strtos32_to_struct_member(), following the
existing strdup_to_offset()/strdup_to_struct_member() pattern.

The helpers wrap ul_strtou32()/ul_strtos32() and write the parsed value
into a struct member addressed by offsetof(), so callers get proper
error and range checking without hand-rolling strtoul().

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 days agofsck.minix, mkfs.minix: fix integer overflows on 32-bit builds
Karel Zak [Tue, 4 Aug 2026 16:03:33 +0000 (18:03 +0200)] 
fsck.minix, mkfs.minix: fix integer overflows on 32-bit builds

On 32-bit builds, block-number-to-byte-offset multiplications
(block_nr * MINIX_BLOCK_SIZE) can overflow when zone numbers exceed
4,194,304. This causes lseek to wrong positions and data to be
read from or written to incorrect offsets. Cast block numbers to
off_t before multiplication to ensure 64-bit arithmetic.

Also add a superblock validation check for inode buffer size
overflow (inode_blocks * MINIX_BLOCK_SIZE can wrap to zero with
crafted Minix v3 s_ninodes values on 32-bit), and fix verbose
percentage display overflow.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agoMerge branch 'ipcmk-do-not-print-a-bogus-errno-for-an-unparsable-mode-s01' of https...
Karel Zak [Tue, 4 Aug 2026 15:24:05 +0000 (17:24 +0200)] 
Merge branch 'ipcmk-do-not-print-a-bogus-errno-for-an-unparsable-mode-s01' of https://github.com/prownd/util-linux

* 'ipcmk-do-not-print-a-bogus-errno-for-an-unparsable-mode-s01' of https://github.com/prownd/util-linux:
  ipcmk: do not print a bogus errno for an unparsable --mode

5 days agoMerge branch 'setpriv-landlock-improvements' of https://github.com/Skyb0rg007/util...
Karel Zak [Tue, 4 Aug 2026 15:03:07 +0000 (17:03 +0200)] 
Merge branch 'setpriv-landlock-improvements' of https://github.com/Skyb0rg007/util-linux

* 'setpriv-landlock-improvements' of https://github.com/Skyb0rg007/util-linux:
  setpriv: improve --landlock-support option
  setpriv: add bash completion to landlock options
  setpriv: add --landlock-support option
  setpriv: limit landlock-rule to access restrictions
  setpriv: error when a landlock rule has no access
  setpriv: add resolve-unix filesystem access option
  setpriv: use rules supported by the current kernel
  setpriv: replace landlock header with our own definitions

6 days agosetpriv: improve --landlock-support option
Skye Soss [Mon, 3 Aug 2026 15:47:46 +0000 (10:47 -0500)] 
setpriv: improve --landlock-support option

The `--landlock-support` option now reports the Landlock errata in
addition to the version, and properly restricts the reported rights
based on the running kernel's Landlock ABI version. It also wraps the
strings with the gettext translation macro.

Signed-off-by: Skye Soss <skye@soss.website>
6 days agolibfdisk: add pluggable VFS I/O support
Karel Zak [Wed, 29 Jul 2026 10:12:27 +0000 (12:12 +0200)] 
libfdisk: add pluggable VFS I/O support

Add fdisk_set_vfs() to allow replacing standard I/O syscalls
(read/write/lseek/open/close/fsync) with custom implementations,
matching the existing VFS support in libblkid and libmount.

All direct I/O calls in the library (context.c, utils.c, dos.c,
gpt.c, bsd.c, sgi.c, sun.c) are replaced with ul_vfs_* wrappers
that fall back to standard syscalls when no VFS is set.

The VFS is also propagated to libblkid probes used in wipe.c
for collision detection and signature wiping.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agoipcmk: do not print a bogus errno for an unparsable --mode
hanjinpeng [Sun, 2 Aug 2026 16:41:11 +0000 (12:41 -0400)] 
ipcmk: do not print a bogus errno for an unparsable --mode

The --mode option is the only one in ipcmk(1) that parses its argument
by hand instead of using the strutils helpers, and it reports the
failure with err(), which appends strerror(errno). strtoul() only sets
errno on overflow, so for a malformed argument errno is still 0 and the
user gets:
    $ ipcmk --queue --mode abc
    ipcmk: failed to parse mode: Success

Use str2unum_or_err(), like the other options in this file already do.
It picks err()/errx() based on errno and prints the offending string:
    $ ipcmk --queue --mode abc
    ipcmk: failed to parse mode: 'abc'

    $ ipcmk --queue --mode 100000
    ipcmk: failed to parse mode: '100000': Numerical result out of range

The 07777 upper bound is the range of the mode bits that the resource
creation calls accept; values above it were silently truncated to int
before.

7 days agoMerge branch 'fix/ReleaseNotes' of https://github.com/echoechoin/util-linux
Karel Zak [Mon, 3 Aug 2026 12:19:30 +0000 (14:19 +0200)] 
Merge branch 'fix/ReleaseNotes' of https://github.com/echoechoin/util-linux

* 'fix/ReleaseNotes' of https://github.com/echoechoin/util-linux:
  docs: fix FIEMAP feature attribution in v2.42-ReleaseNotes

7 days agoMerge branch 'fix-befs-fuzz' of https://github.com/mbroz/util-linux
Karel Zak [Mon, 3 Aug 2026 12:12:15 +0000 (14:12 +0200)] 
Merge branch 'fix-befs-fuzz' of https://github.com/mbroz/util-linux

* 'fix-befs-fuzz' of https://github.com/mbroz/util-linux:
  libblkid: befs: fix possible load of misaligned address
  libblkid: befs: fix possible too large shift

7 days agoMerge branch 'bits-fix-the-layout-of-the-help-output-s01' of https://github.com/prown...
Karel Zak [Mon, 3 Aug 2026 12:05:13 +0000 (14:05 +0200)] 
Merge branch 'bits-fix-the-layout-of-the-help-output-s01' of https://github.com/prownd/util-linux

* 'bits-fix-the-layout-of-the-help-output-s01' of https://github.com/prownd/util-linux:
  bits: fix the layout of the --help output

7 days agodocs: fix label type name in fdisk and sfdisk man pages
Karel Zak [Mon, 3 Aug 2026 11:15:20 +0000 (13:15 +0200)] 
docs: fix label type name in fdisk and sfdisk man pages

BSD and SUN are different disklabel types; the default on SPARC is SUN,
not BSD.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 days agoMerge branch 'addgptasdefaultinstdout' of https://github.com/Persioqq/util-linux
Karel Zak [Mon, 3 Aug 2026 11:14:14 +0000 (13:14 +0200)] 
Merge branch 'addgptasdefaultinstdout' of https://github.com/Persioqq/util-linux

* 'addgptasdefaultinstdout' of https://github.com/Persioqq/util-linux:
  libfdisk: recommend GPT on interactive terminals on EFI systems for an empty device

7 days agobits: fix the layout of the --help output
hanjinpeng [Sun, 2 Aug 2026 16:44:24 +0000 (12:44 -0400)] 
bits: fix the layout of the --help output

The -w/--width and -f/--fail-width entries are printed after
USAGE_HELP_OPTIONS(), so --help and --version show up in the middle of
the option list instead of at its end, unlike every other util-linux
program. The description of -f is also indented by one column too many
and does not line up with the rest.
Options:
 -h, --help          display this help
 -V, --version       display version
 -w <num>, --width <num>
                     maximum width of bit masks (default 8192)
 -f, --fail-width     fail if bit list contains values wider than width

7 days agolibfdisk: recommend GPT on interactive terminals on EFI systems for an empty device
Henrique Surian Stobbe [Wed, 15 Jul 2026 18:12:12 +0000 (15:12 -0300)] 
libfdisk: recommend GPT on interactive terminals on EFI systems for an empty device

When running fdisk or sfdisk on a device without any partition label, on a terminal
(stdin) and on an EFI system, the function fdisk_get_recommended_labelname() suggests
the GPT disklabel; otherwise, it returns DOS, or SUN on SPARC.

Addresses: https://github.com/util-linux/util-linux/issues/4478

Signed-off-by: Henrique Surian Stobbe <henriquesstobbe@gmail.com>
8 days agosetpriv: add bash completion to landlock options
Skye Soss [Sat, 18 Jul 2026 19:17:24 +0000 (14:17 -0500)] 
setpriv: add bash completion to landlock options

--landlock-access and --landlock-rule accept colon-separated arguments,
which is difficult to generate completions for as Bash defaults to
splitting words on colon. This implementation takes inspiration from the
git's bash completion script and re-combines the words that were split
in this way before processing the rest of the options.

For example, `setpriv --landlock-access fs:execute<TAB>` is provided as
COMP_WORDS=('setpriv' '--landlock-access' 'fs' ':' 'execute'). The glue
code then constructs words=('setpriv' '--landlock-access' 'fs:execute'),
which is used to produce the completion.

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: add --landlock-support option
Skye Soss [Tue, 28 Jul 2026 21:32:02 +0000 (16:32 -0500)] 
setpriv: add --landlock-support option

Adds the --landlock-support option to query the current running kernel's
support for landlock. Also adds the --list-landlock-access and
--list-landlock-rights options which are used for implementing bash
completion (much like --list-caps).

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: limit landlock-rule to access restrictions
Skye Soss [Sat, 18 Jul 2026 19:54:43 +0000 (14:54 -0500)] 
setpriv: limit landlock-rule to access restrictions

When `--landlock-rule` is provided without an explicit list of
restrictions (ex. `--landlock-rule path-beneath::/`), setpriv would
treat this as if it was specifying all access restrictions. If the
`--landlock-access` argument only specified a limited set of
restrictions, then the call to landlock_add_rule would fail as setpriv
would attempt to allow an access pattern that wasn't being restricted.

Now, passing an empty list of access patterns is instead treated as "all
access restrictions that are enabled". So `setpriv --landlock-access
fs:execute --landlock-rule path-beneath::/usr -- true` will now be
treated as if `--landlock-rule path-beneath:execute:/usr` was provided.

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: error when a landlock rule has no access
Skye Soss [Sat, 18 Jul 2026 18:26:53 +0000 (13:26 -0500)] 
setpriv: error when a landlock rule has no access

The --landlock-rule option is used to allow operations through the
restriction introduced by a --landlock-access option. Specifying
--landlock-rule without specifying the corresponding --landlock-access
is always a user error, so produce an error message when that happens.

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: add resolve-unix filesystem access option
Skye Soss [Sat, 18 Jul 2026 18:20:00 +0000 (13:20 -0500)] 
setpriv: add resolve-unix filesystem access option

The LANDLOCK_ACCESS_FS_RESOLVE_UNIX option is supported by Landlock ABI
version 9, which was added in Linux 7.1.

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: use rules supported by the current kernel
Skye Soss [Sat, 18 Jul 2026 18:14:32 +0000 (13:14 -0500)] 
setpriv: use rules supported by the current kernel

When an empty filesystem access list is provided to --landlock-access or
to --landlock-rule, setpriv enables all access rules. This causes
errors when run on older kernel versions. Now when an explicit list is
not provided, setpriv will only use the access rules supported by the
running kernel version.

Signed-off-by: Skye Soss <skye@soss.website>
8 days agosetpriv: replace landlock header with our own definitions
Skye Soss [Sat, 18 Jul 2026 17:54:52 +0000 (12:54 -0500)] 
setpriv: replace landlock header with our own definitions

The version of Landlock that the current kernel supports may be
different from the version of the <linux/landlock.h> header from the
build machine. Instead of using the header, define the values used by
setpriv directly; unsupported options will be determined at runtime.
The configuration checks now use the presence of the __NR_landlock_*
macros to determine Landlock support.

Signed-off-by: Skye Soss <skye@soss.website>
9 days agolibblkid: befs: fix possible load of misaligned address
Milan Broz [Fri, 31 Jul 2026 14:27:45 +0000 (16:27 +0200)] 
libblkid: befs: fix possible load of misaligned address

The misaligned uint16_t loads can come only form a corrupt metadata.

Found by OSS-Fuzz by cryptsetup project fuzzers (issue 507641687).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
9 days agolibblkid: befs: fix possible too large shift
Milan Broz [Fri, 31 Jul 2026 14:27:45 +0000 (16:27 +0200)] 
libblkid: befs: fix possible too large shift

The existing guard needs to be evaluated as uint64_t otherwise
it wraps around.

Found by OSS-Fuzz by cryptsetup project fuzzers (issue 507641687).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
10 days agodocs: fix FIEMAP feature attribution in v2.42-ReleaseNotes
WanBingjiang [Fri, 31 Jul 2026 08:27:13 +0000 (16:27 +0800)] 
docs: fix FIEMAP feature attribution in v2.42-ReleaseNotes

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
11 days agotools: switch libeconf to runtime optional via dlopen
Luca Boccassi [Fri, 17 Jul 2026 18:00:29 +0000 (19:00 +0100)] 
tools: switch libeconf to runtime optional via dlopen

Replace direct libeconf linking with runtime dlopen() using the
shared dl-utils infrastructure. All tools that use libeconf functions
now call them through econf_call() macro and gracefully handle the
case when libeconf is not installed at runtime.

Affected tools: login, su, runuser, chfn, chsh, agetty, lslogins,
setpriv, nologin, blkid, mount, lsblk, wipefs

All tools gracefully degrade to default/built-in configs if
the library is missing.

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
11 days agoMerge branch 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux...
Karel Zak [Wed, 29 Jul 2026 12:32:43 +0000 (14:32 +0200)] 
Merge branch 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux-work

* 'PR/pty-terminal-setup-race' of https://github.com/karelzak/util-linux-work:
  pty-session: defer raw mode until after signals are blocked

11 days agotools: switch libsystemd to runtime optional via dlopen
Luca Boccassi [Fri, 17 Jul 2026 17:09:01 +0000 (18:09 +0100)] 
tools: switch libsystemd to runtime optional via dlopen

Replace direct libsystemd linking with runtime dlopen() using the
shared dl-utils infrastructure. All tools that use libsystemd functions
now call them through systemd_call() macro and gracefully handle the
case when libsystemd is not installed at runtime.

Affected tools: agetty, wall, write, lslogins, mount, umount, zramctl,
uuidd, logger

uuidd and logger when called for the systemd-specific functionality
will fail if the library is missing. Other tools will gracefully
degrade to systemd-less functionality.

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
11 days agobuild: fix build with binutils < 2.36
Luca Boccassi [Fri, 17 Jul 2026 18:17:08 +0000 (19:17 +0100)] 
build: fix build with binutils < 2.36

The R (SHF_GNU_RETAIN) section flag is only understood by binutils >= 2.36.
Detect it at compile time. When not available, the ELF note section
might be duplicated. Parsing tools can deal with it, so it's better than
failing the build.

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
11 days agolib/dl-utils: fix build on alpha
Luca Boccassi [Fri, 17 Jul 2026 18:14:01 +0000 (19:14 +0100)] 
lib/dl-utils: fix build on alpha

Import change from systemd's sd-dlopen to fix build on alpha
as ".set" is overridden to mean something else, but on hppa
".equ" is also overridden.

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
12 days agolsfd: update man page for bpf-map NAME format
Karel Zak [Wed, 29 Jul 2026 11:07:47 +0000 (13:07 +0200)] 
lsfd: update man page for bpf-map NAME format

Note that the bpf-map NAME format is used only for opened file
objects, not for mapped ones.

Addresses: https://github.com/util-linux/util-linux/pull/4501
Signed-off-by: Karel Zak <kzak@redhat.com>
12 days agoMerge branch 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 29 Jul 2026 11:06:05 +0000 (13:06 +0200)] 
Merge branch 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux

* 'lsfd/fix-bpf-map' of https://github.com/echoechoin/util-linux:
  tests: (lsfd) add mapped-bpf-map test case
  test: (mkfds::mapped-bpf-map) new factory
  lsfd: improve bpf-map display when fdinfo is not available

12 days agoMerge branch 'lsfd/typo' of https://github.com/echoechoin/util-linux
Karel Zak [Tue, 28 Jul 2026 13:24:44 +0000 (15:24 +0200)] 
Merge branch 'lsfd/typo' of https://github.com/echoechoin/util-linux

* 'lsfd/typo' of https://github.com/echoechoin/util-linux:
  lsfd: fix typo.

12 days agoMerge branch 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux
Karel Zak [Tue, 28 Jul 2026 13:02:37 +0000 (15:02 +0200)] 
Merge branch 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux

* 'fdisk-fix-t-type-autocreate' of https://github.com/Persioqq/util-linux:
  fdisk: fix -t/--type when auto-creating a label on empty devices

12 days agoagetty: move man page to agetty-cmd/
Karel Zak [Tue, 28 Jul 2026 12:57:52 +0000 (14:57 +0200)] 
agetty: move man page to agetty-cmd/

The agetty source was moved to agetty-cmd/ but the man page
agetty.8.adoc was left behind in term-utils/. Move it to agetty-cmd/
and update references in meson.build, Makemodule.am, and po-man/po4a.cfg.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 days agoagetty: show default issue file when built without issue.d support
lzwind [Tue, 28 Jul 2026 12:33:00 +0000 (14:33 +0200)] 
agetty: show default issue file when built without issue.d support

Commit d1cf7ef refactored the issue file handling to read the default
issue file (/etc/issue) together with the issue.d drop-in directory
through ul_configs_file_list(). That call was placed inside an
"#ifdef ISSUEDIR_SUPPORT" block, so on builds without issue.d support
(e.g. systems where scandirat()/openat() are unavailable, such as musl
libc) the default issue file was no longer read at all.

As a result `agetty --show-issue` and the login prompt printed nothing
on such builds unless --issue-file was given, regressing the long-standing
behaviour of displaying /etc/issue.

ul_configs_file_list() returns the main issue file even when drop-in
directory support is unavailable (it skips the drop-in scan but still
locates the main configuration file), so move the call out from under
ISSUEDIR_SUPPORT and include configs.h unconditionally. The drop-in
directory scanning itself still requires ISSUEDIR_SUPPORT, which is
unchanged.

[kzak: removed github issue URL from in-code comment]

Fixes: https://github.com/util-linux/util-linux/issues/4505
Suggested-by: Naomi Rennie-Waldock <naomi.renniewaldock@gmail.com>
Signed-off-by: lzwind <liuzheng@uniontech.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agopty-session: defer raw mode until after signals are blocked
Karel Zak [Tue, 28 Jul 2026 12:16:31 +0000 (14:16 +0200)] 
pty-session: defer raw mode until after signals are blocked

ul_pty_setup() switches the user's terminal to raw mode before
ul_pty_signals_setup() blocks signals. A terminating signal delivered
in this window kills the process without reaching ul_pty_cleanup(),
leaving the terminal in raw mode.

Move the raw-mode tcsetattr() out of ul_pty_setup() into a new
ul_pty_terminal_setup() function, to be called after
ul_pty_signals_setup(). This ensures signals are already directed
to signalfd when raw mode is activated, closing the race window.

The setup sequence is now:
  ul_pty_setup()          -- open pty, save terminal attrs
  <app-specific work>     -- e.g. utempter (needs SIGCHLD unblocked)
  ul_pty_signals_setup()  -- block signals, create signalfd
  ul_pty_terminal_setup() -- set raw mode (signals already blocked)
  fork()

Addresses: https://github.com/util-linux/util-linux/issues/4499
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agofdisk: fix -t/--type when auto-creating a label on empty devices
Henrique Surian Stobbe [Fri, 17 Jul 2026 00:58:17 +0000 (21:58 -0300)] 
fdisk: fix -t/--type when auto-creating a label on empty devices

fdisk_create_disklabel(cxt, NULL) always resolves to "dos" or "sun",
regardless of any restriction set via -t/--type. If -t disabled "dos"
(like in -t gpt) auto-creation on an empty device fails with -EINVAL.
As the return code was never checked, the failure was silent,
thus no label got created and no error was shown.

The requested label via -t is now passed to the auto-create call,
which warns if creation still fails.

There is no behavior change when -t is not used in the program.

Signed-off-by: Henrique Surian Stobbe <henriquesstobbe@gmail.com>
2 weeks agotests: (lsfd) add mapped-bpf-map test case
WanBingjiang [Thu, 23 Jul 2026 07:35:18 +0000 (15:35 +0800)] 
tests: (lsfd) add mapped-bpf-map test case

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
2 weeks agopty-session: handle SIGALRM instead of aborting
lzwind [Fri, 24 Jul 2026 13:00:15 +0000 (21:00 +0800)] 
pty-session: handle SIGALRM instead of aborting

ul_pty_signals_setup() subscribes to SIGALRM through the signalfd set,
but handle_signal() has no case for it, so a SIGALRM delivered to the
proxy (e.g. an alarm(2) timer armed before execve(), or an external
"kill -ALRM") falls through to "default: abort()".

The abort() terminates script/su --pty/runuser --pty with SIGABRT before
ul_pty_cleanup() runs, leaving the user's terminal in raw mode (no echo,
no canonical mode, no signal generation) until "stty sane" is run.

Treat SIGALRM like the other terminating signals (SIGHUP/SIGTERM/SIGINT/
SIGQUIT): record it in delivered_signal and forward SIGTERM to the child
so the proxy leaves its poll() loop through the normal path and
ul_pty_cleanup() restores the saved terminal settings. The default
disposition of SIGALRM is termination, so this preserves the previous
outcome while adding the cleanup.

None of script, su --pty or runuser --pty arms SIGALRM internally on this
code path.

This addresses the deterministic SIGALRM path reported in #4499. The
separate, much narrower window where a terminating signal arrives
between ul_pty_setup() (raw mode on) and ul_pty_signals_setup() (signals
blocked) is not addressed here; closing it requires reworking the signal
mask contract between those two calls.

Partially fixes: https://github.com/util-linux/util-linux/issues/4499
Signed-off-by: lzwind <liuzheng@uniontech.com>
2 weeks agolsfd: fix typo.
WanBingjiang [Fri, 24 Jul 2026 07:20:45 +0000 (15:20 +0800)] 
lsfd: fix typo.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
2 weeks agotest: (mkfds::mapped-bpf-map) new factory
WanBingjiang [Thu, 23 Jul 2026 07:10:19 +0000 (15:10 +0800)] 
test: (mkfds::mapped-bpf-map) new factory

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
2 weeks agolsfd: improve bpf-map display when fdinfo is not available
WanBingjiang [Thu, 23 Jul 2026 07:08:41 +0000 (15:08 +0800)] 
lsfd: improve bpf-map display when fdinfo is not available

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
2 weeks agoMerge branch 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux
Karel Zak [Thu, 23 Jul 2026 09:46:39 +0000 (11:46 +0200)] 
Merge branch 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux

* 'fix/fdisk-gpt-first-usable-lba' of https://github.com/lzwind/util-linux:
  fdisk: derive first usable LBA from the real primary entries location

2 weeks agoMerge branch 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com...
Karel Zak [Thu, 23 Jul 2026 09:34:16 +0000 (11:34 +0200)] 
Merge branch 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com/dengzhongyuan365-dev/util-linux

* 'fix/scriptreplay-divisor-fractional-seconds' of https://github.com/dengzhongyuan365-dev/util-linux:
  scriptreplay: fix --divisor discarding fractional seconds

2 weeks agoMerge branch 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux
Karel Zak [Thu, 23 Jul 2026 09:23:05 +0000 (11:23 +0200)] 
Merge branch 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux

* 'fix/pg-endline-tab-oob' of https://github.com/logical-misha/util-linux:
  pg: fix out-of-bounds access past wbuf on a trailing tab

2 weeks agoMerge branch 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util...
Karel Zak [Thu, 23 Jul 2026 09:19:19 +0000 (11:19 +0200)] 
Merge branch 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util-linux

* 'fix/more-get_line-mbc-oob' of https://github.com/logical-misha/util-linux:
  more: fix out-of-bounds write in get_line() on invalid multibyte input

2 weeks agofdisk: derive first usable LBA from the real primary entries location
lzwind [Thu, 23 Jul 2026 06:55:54 +0000 (14:55 +0800)] 
fdisk: derive first usable LBA from the real primary entries location

fdisk_gpt_set_npartitions() (the expert "change table length" command)
computed the first usable LBA with gpt_calculate_first_lba(), which
assumes the primary partition entries array is at the default LBA 2. The
primary entries array is not relocated when the table length changes, so
on a GPT whose primary entries are not at the default location the usable
area ended up overlapping the entries array and a partition could be
created on top of it.

Derive the first usable LBA from the actual on-disk location of the
primary entries array (pheader->partition_entry_lba) instead. The backup
entries array is recalculated to the default end-of-device location by
gpt_mknew_header_common(), so gpt_calculate_last_lba() is still based on
the default layout and is left unchanged.

Add a regression test that relocates the primary entries array to a
non-default LBA and checks the first usable LBA after a "change table
length" operation.

Fixes: https://github.com/util-linux/util-linux/issues/3923
Signed-off-by: lzwind <liuzheng@uniontech.com>
2 weeks agoMerge branch 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux
Karel Zak [Thu, 23 Jul 2026 08:05:31 +0000 (10:05 +0200)] 
Merge branch 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux

* 'lsfd/bpf-link' of https://github.com/echoechoin/util-linux:
  test: (lsfd) add a case for testing bpf-link related columns
  test: (mkfds::bpf-link) new factory
  lsfd: add configure check for BPF_LINK_CREATE
  lsfd: introduce bpf-link anon-inode support

2 weeks agoscriptreplay: fix --divisor discarding fractional seconds
dengzhongyuan365-dev [Thu, 23 Jul 2026 01:42:15 +0000 (09:42 +0800)] 
scriptreplay: fix --divisor discarding fractional seconds

replay_get_next_step() divided the tv_sec and tv_usec fields of the
recorded delay by the divisor independently.  Both fields are integers, so
the fractional part of the whole-seconds field was discarded instead of
being carried into microseconds.  Replaying a 1.000000 s delay with
--divisor 2 therefore produced a 0.000000 s delay (the next step was
emitted immediately) instead of the expected 0.500000 s, and the error
could approach one second per step and accumulate across recordings with
multiple pauses.

Scale the complete duration once in microseconds, then split the result
back into seconds and microseconds so the fractional whole-seconds part is
preserved.  This affects both scriptreplay and scriptlive, which share the
helper.

Add a "divisor-fractional" subtest to tests/ts/script/replay that verifies
a 1.000000 s delay scaled by --divisor 2 takes about half a second rather
than collapsing to zero.

Addresses: https://github.com/util-linux/util-linux/issues/4500
Signed-off-by: dengzhongyuan365-dev <dengzhongyuan@uniontech.com>
2 weeks agopg: fix out-of-bounds access past wbuf on a trailing tab
logical-misha [Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)] 
pg: fix out-of-bounds access past wbuf on a trailing tab

endline_for_mb() and its single-byte twin endline() advance the scan
pointer twice when the last character of a buffer-filling line is a tab
(once in the tab branch, once via the shared *++p) with no terminator
re-check in between. A full line (wl == READBUF-1) ending in a tab makes
*++p read wbuf[READBUF] and the following *end = L'\0' write it -- one
element past the wbuf[READBUF] array.

Re-check for the terminator before the second advance.

Closes #4495

Signed-off-by: logical-misha <220645577+logical-misha@users.noreply.github.com>
2 weeks agomore: fix out-of-bounds write in get_line() on invalid multibyte input
logical-misha [Tue, 21 Jul 2026 04:55:43 +0000 (04:55 +0000)] 
more: fix out-of-bounds write in get_line() on invalid multibyte input

In get_line(), the invalid-multibyte switch arm (case (size_t)-1) writes
*p++ = mbc[0] without the bounds check that its sibling write paths use,
and the "goto process_mbc" back-edge lets it re-run within one loop
iteration, bypassing the loop-head guard. A line that first fills line_buf
with zero-width combining characters (which advance p but not column) and
then supplies an invalid multibyte sequence can step p past the
num_columns*4 + 2 byte allocation -- a heap out-of-bounds write.

Guard the write the same way the sibling path does.

Closes #4494

Signed-off-by: logical-misha <220645577+logical-misha@users.noreply.github.com>
2 weeks agotest: (lsfd) add a case for testing bpf-link related columns
WanBingjiang [Thu, 16 Jul 2026 03:32:14 +0000 (11:32 +0800)] 
test: (lsfd) add a case for testing bpf-link related columns

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 weeks agoMerge branch 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util...
Karel Zak [Mon, 20 Jul 2026 10:52:12 +0000 (12:52 +0200)] 
Merge branch 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util-linux_

* 'fix-rename-lsipc-three-bugs' of https://github.com/lionheartyu/util-linux_:
  lsipc: report shared memory creator GID correctly
  lsipc: print numeric permissions for message queues
  rename: honor no-overwrite for dangling symlinks

3 weeks agotest: (mkfds::bpf-link) new factory
WanBingjiang [Thu, 16 Jul 2026 03:31:12 +0000 (11:31 +0800)] 
test: (mkfds::bpf-link) new factory

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 weeks agolsfd: add configure check for BPF_LINK_CREATE
WanBingjiang [Wed, 15 Jul 2026 09:06:28 +0000 (17:06 +0800)] 
lsfd: add configure check for BPF_LINK_CREATE

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 weeks agolsfd: introduce bpf-link anon-inode support
WanBingjiang [Wed, 15 Jul 2026 08:33:26 +0000 (16:33 +0800)] 
lsfd: introduce bpf-link anon-inode support

Add BPF link file descriptor decoding to lsfd, following the same
pattern as bpf-prog and bpf-map.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 weeks agoMerge branch 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 20 Jul 2026 08:40:00 +0000 (10:40 +0200)] 
Merge branch 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-vfs' of https://github.com/karelzak/util-linux-work:
  docs: add VFS symbols to libmount-sections.txt
  tests: add libmount VFS test
  libmount: add VFS test to test_mount_context
  libmount: add pluggable VFS I/O support

3 weeks agolsipc: report shared memory creator GID correctly
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
lsipc: report shared memory creator GID correctly

Change:
  Use shm_perm.cgid for the shared memory CGID column.
  Keep CGID consistent with CGROUP and other IPC types.

Before:
  lsipc --shmems --creator printed CUID as CGID.
  The error was visible when creator UID and GID differed.

Follow:
  d8461c4e4d8046fb8bd1da8c57383854159d48d1

3 weeks agolsipc: print numeric permissions for message queues
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
lsipc: print numeric permissions for message queues

Change:
  Move scols_line_refer_data() outside the else branch.
  Apply this to System V and POSIX message queues.

Before:
  --numeric-perms left PERMS empty for message queues.
  OWNER shifted into the PERMS field in normal output.

Follow:
  9d20ffda794208d26e6b3ed09fbc38d94d0b8fc6
  c457ec945b4457418af6d5d80f4e6357b15cba9b

3 weeks agorename: honor no-overwrite for dangling symlinks
dongshengyuan [Fri, 17 Jul 2026 10:20:18 +0000 (18:20 +0800)] 
rename: honor no-overwrite for dangling symlinks

Change:
  Use lstat() for destination existence checks.
  Treat dangling symlinks as existing entries.

Before:
  rename --no-overwrite replaced the dangling symlink.
  rename --copy --no-overwrite followed it and created target.

Follow:
  eb4aea8a4756be04655f31b286bc33b593f2689f
  d021e24bc185cca05cf81a257648ec5d2d94f0e4

3 weeks agodocs: add VFS symbols to libmount-sections.txt
Karel Zak [Wed, 15 Jul 2026 11:09:46 +0000 (13:09 +0200)] 
docs: add VFS symbols to libmount-sections.txt

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 70806a09ec55defc201728d8946d3a19676ff827)

3 weeks agotests: add libmount VFS test
Karel Zak [Wed, 15 Jul 2026 11:06:24 +0000 (13:06 +0200)] 
tests: add libmount VFS test

Add test script that exercises the pluggable VFS I/O operations:

  table-fstab      -- verify vfs_fopen callback for fstab parsing
  table-mountinfo  -- verify vfs_fopen callback for mountinfo parsing
  blkid            -- verify vfs_open/read/lseek/close for device probing

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: add VFS test to test_mount_context
Karel Zak [Wed, 15 Jul 2026 10:46:06 +0000 (12:46 +0200)] 
libmount: add VFS test to test_mount_context

Add --vfs test that exercises the pluggable VFS I/O operations with
three sub-options:

  --table <file>   parse a mount table through VFS fopen
  --cache <dev>    probe device via cache (udev, then blkid)
  --blkid <dev>    probe device directly via libblkid VFS

The test sets up VFS callbacks that wrap standard syscalls and report
call counts, verifying that I/O is routed through the pluggable layer.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: add pluggable VFS I/O support
Karel Zak [Wed, 15 Jul 2026 10:21:29 +0000 (12:21 +0200)] 
libmount: add pluggable VFS I/O support

Add three new public APIs for pluggable VFS I/O operations:

- mnt_context_set_vfs(cxt, ops) -- set VFS on mount context (owned copy)
- mnt_cache_refer_vfs(cache, vfs) -- set VFS reference on cache (borrowed)
- mnt_table_refer_vfs(tb, vfs) -- set VFS reference on table (borrowed)

The VFS operations are automatically propagated from the context to its
cache and tables when they are created or set.

Convert blkid probe calls in cache.c (read_from_blkid, fstype_from_blkid)
from blkid_new_probe_from_filename() to the VFS-aware 3-step pattern:
blkid_new_probe() + blkid_probe_set_vfs() + blkid_probe_open_device().

Convert mnt_table_parse_file() to use ul_vfs_fopen() for VFS-aware
file opening.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 15 Jul 2026 11:19:56 +0000 (13:19 +0200)] 
Merge branch 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work

* 'PR/docs-gtk-doc-fixes' of https://github.com/karelzak/util-linux-work:
  docs: update libfdisk gtk-doc configuration
  docs: update libsmartcols gtk-doc configuration
  docs: update libblkid gtk-doc configuration
  docs: update libmount gtk-doc configuration
  libmount: fix gtk-doc comments and declarations

3 weeks agoMerge branch 'PR/dl-utils' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 15 Jul 2026 11:19:37 +0000 (13:19 +0200)] 
Merge branch 'PR/dl-utils' of https://github.com/karelzak/util-linux-work

* 'PR/dl-utils' of https://github.com/karelzak/util-linux-work:
  tools: switch SELinux to runtime optional via dlopen
  libmount: use shared dl-utils for SELinux dlopen
  libmount: fix -Wunterminated-string-initialization warning
  libmount: use shared dl-utils for cryptsetup dlopen
  lib/dl-utils: add shared dlopen/dlsym infrastructure

3 weeks agodocs: findmnt: clarify that --target returns one filesystem
Karel Zak [Tue, 14 Jul 2026 12:48:39 +0000 (14:48 +0200)] 
docs: findmnt: clarify that --target returns one filesystem

The --target option identifies the filesystem for a given path, and a
file always resides on exactly one filesystem. Document that --target
returns at most one entry and skips over-mounted entries.

Addresses: https://github.com/util-linux/util-linux/issues/4424
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'fix-target' of https://github.com/dengbo11/util-linux
Karel Zak [Tue, 14 Jul 2026 12:46:01 +0000 (14:46 +0200)] 
Merge branch 'fix-target' of https://github.com/dengbo11/util-linux

* 'fix-target' of https://github.com/dengbo11/util-linux:
  findmnt: skip shadowed entries when matching by --target

3 weeks agotools: switch SELinux to runtime optional via dlopen
Karel Zak [Mon, 13 Jul 2026 14:28:43 +0000 (16:28 +0200)] 
tools: switch SELinux to runtime optional via dlopen

Replace direct libselinux linking with runtime dlopen() using the
shared dl-utils infrastructure. All tools that use SELinux functions
now call them through selinux_call() macro and gracefully handle the
case when libselinux is not installed at runtime.

Affected tools: mkswap, chfn, chsh, lslogins, sulogin, vipw, namei,
mount, nsenter, login.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: use shared dl-utils for SELinux dlopen
Karel Zak [Mon, 13 Jul 2026 14:18:29 +0000 (16:18 +0200)] 
libmount: use shared dl-utils for SELinux dlopen

Add lib/dl-selinux.c and include/dl-selinux.h as a SELinux dlopen
wrapper using the shared dl-utils infrastructure. This replaces the
direct libselinux linking with runtime dlopen(), allowing libmount to
gracefully handle the case when libselinux is not installed.

The hook_selinux.c and lib/selinux-utils.c now use selinux_call()
macro to call SELinux functions through the dlopen'd function pointer
table.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: fix -Wunterminated-string-initialization warning
Karel Zak [Mon, 13 Jul 2026 13:45:26 +0000 (15:45 +0200)] 
libmount: fix -Wunterminated-string-initialization warning

The "xx\0" string literal is 4 bytes but buf is only 3, truncating
the NUL terminator.  Since the buffer is immediately overwritten by
memcpy, just zero-initialize it instead.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: use shared dl-utils for cryptsetup dlopen
Karel Zak [Mon, 13 Jul 2026 13:42:14 +0000 (15:42 +0200)] 
libmount: use shared dl-utils for cryptsetup dlopen

Move the cryptsetup dlopen wrapper out of hook_veritydev.c into
lib/dl-cryptsetup.c with a global cached load function
ul_dlopen_libcryptsetup().  The function pointers are resolved once
and shared across all callers.

This removes the CRYPTSETUP_VIA_DLOPEN conditional -- dlopen is now the
only supported way to use libcryptsetup.  The library is never linked
directly.

An ELF .note.dlopen metadata note is emitted so that packaging tools
can automatically derive the optional runtime dependency.

Also fix the CFLAGS order in libmount Makemodule.am to ensure local
include paths (-I for blkid, libmount) come before external pkg-config
flags that may pull in system headers.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodocs: update libfdisk gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:31:28 +0000 (14:31 +0200)] 
docs: update libfdisk gtk-doc configuration

- add api-index entries for versions 2.41, 2.42 and 2.43
- add missing @start and @size parameter docs for
  fdisk_is_collision_area()
- fix "Since: v2.42" -> "Since: 2.42"

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodocs: update libsmartcols gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:28:27 +0000 (14:28 +0200)] 
docs: update libsmartcols gtk-doc configuration

- add api-index entries for versions 2.41, 2.42 and 2.43
- fix wrap_nextchunk() -> @wrap_nextchunk in doc comment to avoid
  broken cross-reference link

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodocs: update libblkid gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 12:21:52 +0000 (14:21 +0200)] 
docs: update libblkid gtk-doc configuration

- fix role="2.35" -> role="2.36" mismatch in api-index entry
- add api-index entries for versions 2.39 and 2.43
- add missing symbols to libblkid-sections.txt (BLKID_EVALUATE_NOPROBE,
  ul_vfs_ops, UL_VFS_OPS_DEFINED, LIBBLKID_VERSION, LIBBLKID_DATE,
  LIBBLKID_MAJOR_VERSION, LIBBLKID_MINOR_VERSION, LIBBLKID_PATCH_VERSION)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agodocs: update libmount gtk-doc configuration
Karel Zak [Tue, 14 Jul 2026 11:56:56 +0000 (13:56 +0200)] 
docs: update libmount gtk-doc configuration

- set SCAN_OPTIONS with --deprecated-guards="LIBMOUNT_DISABLE_DEPRECATED"
- add monitor.h to IGNORE_HFILES (private header)
- add statmount.xml section include to libmount-docs.xml
- add api-index entries for versions 2.42 and 2.43
- remove api-index entries for non-existent versions 2.37 and 2.39
- add missing symbols to libmount-sections.txt (MNT_ERR_ONLYONCE,
  MNT_ERR_CHOWN, MNT_ERR_CHMOD, MNT_ERR_IDMAP, MNT_ERR_EXEC,
  MNT_EX_EXEC, MNT_MS_VERITY_ON_CORRUPTION, MS_NOSYMFOLLOW,
  MNT_NOFSTAB, MNT_SUPERBLOCK)

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibmount: fix gtk-doc comments and declarations
Karel Zak [Tue, 14 Jul 2026 11:56:27 +0000 (13:56 +0200)] 
libmount: fix gtk-doc comments and declarations

- add LIBMOUNT_DISABLE_DEPRECATED guards around deprecated function
  declarations (mnt_optstr_apply_flags, mnt_has_regular_mtab,
  mnt_get_mtab_path)
- move mnt_table_enable_noautofs() and mnt_table_is_noautofs()
  declarations from private mountP.h to public libmount.h.in,
  convert doc comments to gtk-doc format
- fix missing colons in struct doc comments (libmnt_update,
  libmnt_context, libmnt_monitor, libmnt_statmnt)
- fix @id -> @ns parameter name in mnt_table_listmount_set_ns() doc
- fix typo mnt_table_fetch_listmont -> mnt_table_fetch_listmount
- fix wrong cross-references mnt_fs_set_ns_id() -> mnt_fs_set_ns(),
  mnt_table_fetch_statmount() -> mnt_fs_fetch_statmount()
- fix "Since: v2.42" -> "Since: 2.42" in mnt_monitor_enable_mountinfo

Signed-off-by: Karel Zak <kzak@redhat.com>