]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 weeks agowrite: cleanup indentation and whitespace
Karel Zak [Wed, 13 May 2026 09:49:51 +0000 (11:49 +0200)] 
write: cleanup indentation and whitespace

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agowrite: use mem2strcpy() for utmp strings
Karel Zak [Wed, 13 May 2026 09:22:59 +0000 (11:22 +0200)] 
write: use mem2strcpy() for utmp strings

The utmp fields ut_user and ut_line are fixed-size buffers not
guaranteed to be null-terminated. Using strncmp(), snprintf() or
memcmp() directly on these fields can read beyond the buffer content.

Use mem2strcpy() to safely copy utmp fields into properly terminated
local buffers before any string operations.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agowrite: always use utmp as fallback
Karel Zak [Wed, 13 May 2026 09:13:03 +0000 (11:13 +0200)] 
write: always use utmp as fallback

The systemd session list may not cover all terminals (e.g., screen,
tmux, or old-style logins). Remove the "if systemd else utmp" pattern
and always fall through to utmp when the target user or tty is not
found in systemd sessions.

Also make sd_get_sessions() and sd_session_get_username() failures
non-fatal — silently fall through to utmp instead of calling errx().

Addresses: https://redhat.atlassian.net/browse/RHEL-157244
Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'PR/lsblk-bcachefs-multidevice' of https://github.com/karelzak/util...
Karel Zak [Wed, 13 May 2026 08:38:07 +0000 (10:38 +0200)] 
Merge branch 'PR/lsblk-bcachefs-multidevice' of https://github.com/karelzak/util-linux-work

* 'PR/lsblk-bcachefs-multidevice' of https://github.com/karelzak/util-linux-work:
  tests: (lsblk) add bcachefs multi-device regression test
  tests: (lsblk) capture multi-device filesystem sysfs in mk-input.sh
  lsblk: add bcachefs multi-device mount propagation

5 weeks agoMerge branch 'macos-prep' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 13 May 2026 08:33:17 +0000 (10:33 +0200)] 
Merge branch 'macos-prep' of https://github.com/t-8ch/util-linux

* 'macos-prep' of https://github.com/t-8ch/util-linux:
  meson: gate schedutils behind its requirements
  meson: gate write on _PATH_UTMP
  meson: gate agetty on _PATH_UTMP
  meson: gate pipesz on F_GETPIPE_SZ
  meson: gate sulogin on shadow.h
  meson: gate switch_root on sys/statfs.h
  meson: gate nsenter on sys/statfs.h
  meson: gate uuidd on sys/signalfd.h
  meson: gate fincore on LINUX
  meson: add build-fincore option
  meson: gate prlimit on prlimit()
  meson: add build-prlimit option
  meson: gate wdctl on linux/watchdog.h
  meson: respect build-wdctl

5 weeks agochrt: add missing #ifdef SCHED_FLAG_RESET_ON_FORK guard
Karel Zak [Wed, 13 May 2026 08:32:57 +0000 (10:32 +0200)] 
chrt: add missing #ifdef SCHED_FLAG_RESET_ON_FORK guard

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agochrt: Add support for (GRUB) bandwidth reclaim
Furkan Caliskan [Mon, 11 May 2026 14:10:30 +0000 (17:10 +0300)] 
chrt: Add support for (GRUB) bandwidth reclaim

The SCHED_DEADLINE policy supports the (GRUB) Greedy Reclamation
of Unused Bandwidth algorithm. This allows tasks to reclaim
bandwidth that are left over by other deadline tasks that finish
their work early, or voluntarily yield the cpu.

Currently, chrt has no way to set the SCHED_FLAG_RECLAIM bit in
the sched_flags field of the sched_attr structure.

Add -G/--reclaim-grub option to allow users to toggle this feature
using the deadline scheduling class.

[kzak@redhat.com: - add missing #ifdef SCHED_FLAG_RECLAIM guards
                  - add comments to #else/#endif for SCHED_DEADLINE block]
Signed-off-by: Furkan Caliskan <frn1furkan10@gmail.com>
5 weeks agoMerge branch 'liblastlog/test/spam' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 13 May 2026 08:07:03 +0000 (10:07 +0200)] 
Merge branch 'liblastlog/test/spam' of https://github.com/t-8ch/util-linux

* 'liblastlog/test/spam' of https://github.com/t-8ch/util-linux:
  liblastlog2: (tests) avoid log spam

5 weeks agoliblastlog2: (tests) avoid log spam
Thomas Weißschuh [Tue, 12 May 2026 21:21:25 +0000 (23:21 +0200)] 
liblastlog2: (tests) avoid log spam

In its current form this test spams the test log with some pointless noise.
Redirect the output to a logfile and validate it, too.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agotests: (getino) skip namespace subtests when not supported
Karel Zak [Tue, 12 May 2026 16:01:52 +0000 (18:01 +0200)] 
tests: (getino) skip namespace subtests when not supported

Skip namespace subtests when the getino namespace ioctl is not
supported, and skip individual subtests when the corresponding
/proc/self/ns/* entry is not readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: (getino) skip namespace subtests when unshare is not supported
Karel Zak [Tue, 12 May 2026 13:10:02 +0000 (15:10 +0200)] 
tests: (getino) skip namespace subtests when unshare is not supported

The namespace subtests use unshare to create isolated namespaces, but
this fails on QEMU and restricted CI containers where namespace
creation is not available. Skip the namespace subtests in this case.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'PR/script-dashdash-optarg' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 12 May 2026 12:50:51 +0000 (14:50 +0200)] 
Merge branch 'PR/script-dashdash-optarg' of https://github.com/karelzak/util-linux-work

* 'PR/script-dashdash-optarg' of https://github.com/karelzak/util-linux-work:
  script: fix "--" separator when used as option argument

5 weeks agomeson: gate schedutils behind its requirements
Thomas Weißschuh [Wed, 29 Apr 2026 12:16:48 +0000 (14:16 +0200)] 
meson: gate schedutils behind its requirements

The targets need various headers, symbols and types.
Encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agochrt: fix multiline error message for unsupported priority
Karel Zak [Tue, 12 May 2026 11:58:15 +0000 (13:58 +0200)] 
chrt: fix multiline error message for unsupported priority

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agomeson: gate write on _PATH_UTMP
Thomas Weißschuh [Wed, 29 Apr 2026 12:28:38 +0000 (14:28 +0200)] 
meson: gate write on _PATH_UTMP

The target needs this symbol, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate agetty on _PATH_UTMP
Thomas Weißschuh [Wed, 29 Apr 2026 12:28:20 +0000 (14:28 +0200)] 
meson: gate agetty on _PATH_UTMP

The target needs this symbol, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate pipesz on F_GETPIPE_SZ
Thomas Weißschuh [Wed, 29 Apr 2026 12:26:45 +0000 (14:26 +0200)] 
meson: gate pipesz on F_GETPIPE_SZ

The target needs this symbol, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate sulogin on shadow.h
Thomas Weißschuh [Wed, 29 Apr 2026 12:13:34 +0000 (14:13 +0200)] 
meson: gate sulogin on shadow.h

The target needs this header, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate switch_root on sys/statfs.h
Thomas Weißschuh [Wed, 29 Apr 2026 11:51:57 +0000 (13:51 +0200)] 
meson: gate switch_root on sys/statfs.h

The target needs this header, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate nsenter on sys/statfs.h
Thomas Weißschuh [Wed, 29 Apr 2026 12:00:49 +0000 (14:00 +0200)] 
meson: gate nsenter on sys/statfs.h

The target needs this header, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agoMerge branch 'chrt_pidino_support' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 12 May 2026 11:53:48 +0000 (13:53 +0200)] 
Merge branch 'chrt_pidino_support' of https://github.com/cgoesche/util-linux-fork

* 'chrt_pidino_support' of https://github.com/cgoesche/util-linux-fork:
  chrt: improve error message for invalid policy value
  chrt: remove redundant initializations to 0 in struct members
  chrt: deduplicate code for process tasks retrieval
  chrt: report actual PID in error message when 0 is specified
  tests: (chrt) simple PID:inode address format test
  chrt: support the 'PID:inode' address format

5 weeks agomeson: gate uuidd on sys/signalfd.h
Thomas Weißschuh [Wed, 29 Apr 2026 12:14:36 +0000 (14:14 +0200)] 
meson: gate uuidd on sys/signalfd.h

The target needs this header, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate fincore on LINUX
Thomas Weißschuh [Wed, 29 Apr 2026 12:33:18 +0000 (14:33 +0200)] 
meson: gate fincore on LINUX

This tool uses Linux-specific API, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: add build-fincore option
Thomas Weißschuh [Wed, 29 Apr 2026 12:33:03 +0000 (14:33 +0200)] 
meson: add build-fincore option

Allow the build of the target to be disabled by the user and also enable
the addition of platform restrictions.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate prlimit on prlimit()
Thomas Weißschuh [Wed, 29 Apr 2026 11:48:38 +0000 (13:48 +0200)] 
meson: gate prlimit on prlimit()

The target needs this function, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: add build-prlimit option
Thomas Weißschuh [Wed, 29 Apr 2026 11:48:00 +0000 (13:48 +0200)] 
meson: add build-prlimit option

Allow the build of the target to be disabled by the user and also enable
the addition of platform restrictions.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: gate wdctl on linux/watchdog.h
Thomas Weißschuh [Wed, 29 Apr 2026 11:53:59 +0000 (13:53 +0200)] 
meson: gate wdctl on linux/watchdog.h

The target needs this header, encode this in the build system.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agomeson: respect build-wdctl
Thomas Weißschuh [Wed, 29 Apr 2026 11:53:18 +0000 (13:53 +0200)] 
meson: respect build-wdctl

The build of wdctl did not respect the existing build-wdctl option.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agoMerge branch 'getino_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 12 May 2026 11:38:31 +0000 (13:38 +0200)] 
Merge branch 'getino_tests' of https://github.com/cgoesche/util-linux-fork

* 'getino_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: (getino) add missing tests
  tests: add EACCES errno to test_strerror

5 weeks agotests: (lsblk) add bcachefs multi-device regression test
Karel Zak [Tue, 12 May 2026 11:33:22 +0000 (13:33 +0200)] 
tests: (lsblk) add bcachefs multi-device regression test

Add a dump from a system with a two-device bcachefs filesystem
(sdc1 + sdc2 mounted at /mnt/test) to verify that mount point
propagation works for all member devices.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: (lsblk) capture multi-device filesystem sysfs in mk-input.sh
Karel Zak [Tue, 12 May 2026 11:33:17 +0000 (13:33 +0200)] 
tests: (lsblk) capture multi-device filesystem sysfs in mk-input.sh

Add capture of /sys/fs/btrfs/<uuid>/devices/ and
/sys/fs/bcachefs/<uuid>/dev-*/block symlinks so that dumps
generated on systems with multi-device btrfs or bcachefs
filesystems include the sysfs data needed for mount propagation
testing.

Also add a "mnt" output with KNAME,FSTYPE,MOUNTPOINT,MOUNTPOINTS
columns.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agolsblk: add bcachefs multi-device mount propagation
Karel Zak [Mon, 11 May 2026 13:25:19 +0000 (15:25 +0200)] 
lsblk: add bcachefs multi-device mount propagation

Add support for bcachefs multi-device filesystems to show mount points
on all member devices, not just the one listed in mountinfo.

The implementation follows the existing btrfs/ZFS multi-device group
framework in mnt.c:

 - Enumerate member devices via /sys/fs/bcachefs/<uuid>/dev-N/block
   symlinks (similar to btrfs /sys/fs/btrfs/<uuid>/devices/).

 - Cache and propagate mount entries to all group members.

The mountinfo entry caching (previously inlined in the btrfs scanner)
has been refactored into the shared fs_devs_cache_mounts() function
used by both btrfs and bcachefs. The function now also filters
mountinfo entries by filesystem type to avoid unnecessary comparisons
with unrelated mounts.

Additionally, fs_devs_add_filesystem() now skips duplicate entries to
prevent the same mount from being cached multiple times.

Note that bcachefs uses a non-standard colon-separated source format in
mountinfo (e.g. "/dev/sdc1:/dev/sdc2") rather than a single device
path. This format is not recognized by libmount's mnt_fs_streq_srcpath(),
so an extra is_source_member() helper is used to match individual
device paths within the compound source string.

Addresses: https://github.com/util-linux/util-linux/discussions/4316
Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoscript: fix "--" separator when used as option argument
Karel Zak [Tue, 12 May 2026 10:49:52 +0000 (12:49 +0200)] 
script: fix "--" separator when used as option argument

The commit 7268e79b added "+" to the getopt_long() options string and
post-getopt "--" detection to support commands after the "--" separator.
The "+" prefix stops getopt at the first non-option argument, which
broke backward compatible "script file -c command" usage.

The commit 70507ab9ea fixed this by pre-scanning argv for "--" before
getopt and removing the "+" prefix to restore GNU getopt argument
permutation. However, the pre-scan was too naive — it treated any "--"
in argv as the separator, even when "--" was used as an argument to an
option (e.g., -I -- or --log-in --). The value can come from a
variable, e.g., script -I "$VAR" will break if $VAR is --.

Note that getopt_long() behavior with "--" depends on the option type:
 - required_argument: "--" is consumed as the option value
 - optional_argument: "--" is NOT consumed, treated as end-of-options
 - no_argument: "--" is treated as end-of-options

Without "+" getopt also permutes arguments, which means non-option
arguments before "--" (like the outfile) become inaccessible after
getopt sets optind past "--". The pre-scan approach is necessary to
split the command part out of argv before getopt runs.

Fix the pre-scan by adding ul_find_argv_separator() to optutils.h.
The helper ul_is_option_with_arg() checks if a given argv entry is an
option that expects its value in the next argv entry, handling both
long options (via o->name) and short/bundled options (via o->val).

The separator search scans backward from each "--" counting consecutive
options-with-required-arg. They pair up (each consumes the next as its
value), so odd count means "--" is consumed as an option argument, even
count means it is the real separator. This correctly handles chained
cases like --log-in --log-in -- where the second --log-in is a value
for the first and "--" is the separator.

Addresses: 70507ab9eaed10b8dd77b77d4ea25c11ee726bed
Reported-by: Evgeny Kapun <abacabadabacaba@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'PR/tests-subtest-lifecycle' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 11 May 2026 11:25:20 +0000 (13:25 +0200)] 
Merge branch 'PR/tests-subtest-lifecycle' of https://github.com/karelzak/util-linux-work

* 'PR/tests-subtest-lifecycle' of https://github.com/karelzak/util-linux-work:
  tests: (findmnt) add missing ts_finalize_subtest
  tests: add ts_finalize_subtest before return in functions
  tests: add ts_finalize_subtest before continue in loops
  tests: move ts_finalize_subtest after if/else blocks
  tests: add subtest status tracking to ts_finalize_subtest

5 weeks agoMerge branch 'PR/build-sys-libeconf-split' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 11 May 2026 11:24:58 +0000 (13:24 +0200)] 
Merge branch 'PR/build-sys-libeconf-split' of https://github.com/karelzak/util-linux-work

* 'PR/build-sys-libeconf-split' of https://github.com/karelzak/util-linux-work:
  meson: check slang headers only when slang library is found
  meson: rename logindefs_c to lib_common_logindefs
  meson: split shells.c out of lib_common into lib_common_shells
  build-sys: drop libcommon_shells from binaries that only need ul_default_shell
  lib: split ul_default_shell() from shells.c into default_shell.c

5 weeks agotests: (lsfd) fix IPv4 label in lsfd_check_udp_lite skip message
Karel Zak [Mon, 11 May 2026 09:59:23 +0000 (11:59 +0200)] 
tests: (lsfd) fix IPv4 label in lsfd_check_udp_lite skip message

The local variable $ip is reset to empty for IPv4 (to form the
"udp" command name), so the skip message "no UDP-Lite available
(IPv$ip)" was printing "(IPv)" instead of "(IPv4)". Use $1
which retains the original argument.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'test_mkfds--make-udplite-optional' of https://github.com/masatake/util...
Karel Zak [Mon, 11 May 2026 09:58:44 +0000 (11:58 +0200)] 
Merge branch 'test_mkfds--make-udplite-optional' of https://github.com/masatake/util-linux

* 'test_mkfds--make-udplite-optional' of https://github.com/masatake/util-linux:
  tests: (lsfd/mkfds-udp*) make UDPLite related test cases skippable
  tests: (lsfd/option-inet{,-udp}) make UDPLite related test case skippable
  tests: (lsfd) add a function checking the availability of UDPLite socket
  tests: (lsfd::mkfds-udp) fix confusion between UDP and UDPLite

5 weeks agoMerge branch 'fix-wipefs-force-manpage-2447' of https://github.com/AndyLau-SOC/util...
Karel Zak [Mon, 11 May 2026 09:47:11 +0000 (11:47 +0200)] 
Merge branch 'fix-wipefs-force-manpage-2447' of https://github.com/AndyLau-SOC/util-linux

* 'fix-wipefs-force-manpage-2447' of https://github.com/AndyLau-SOC/util-linux:
  docs: clarify wipefs --force description for partition-table signatures

5 weeks agoipcutils: use memset explicitly to fill bpf_attr with zero
Masatake YAMATO [Tue, 5 May 2026 20:05:51 +0000 (05:05 +0900)] 
ipcutils: use memset explicitly to fill bpf_attr with zero

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (test_mkfds) use memset explicitly to fill bpf_attr with zero
Masatake YAMATO [Tue, 5 May 2026 19:37:30 +0000 (04:37 +0900)] 
tests: (test_mkfds) use memset explicitly to fill bpf_attr with zero

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agoci: use GCC 15
Thomas Weißschuh [Mon, 30 Dec 2024 21:53:13 +0000 (22:53 +0100)] 
ci: use GCC 15

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agolsfd: use memset explicitly to fill bpf_attr with zero
Masatake YAMATO [Sat, 25 Apr 2026 23:57:17 +0000 (08:57 +0900)] 
lsfd: use memset explicitly to fill bpf_attr with zero

The original code used initialize-lists for initializing
variables (attr) type of union bpf_attr.

However, the folloing syscalls failed with EINVAL:

     syscall(SYS_bpf, BPF_PROG_GET_FD_BY_ID, &attr, sizeof(attr));
     syscall(SYS_bpf, BPF_MAP_GET_FD_BY_ID, &attr, sizeof(attr));

CHECK_ATTR macro of Linux might cause EINVAL:

    /* helper macro to check that unused fields 'union bpf_attr' are zero */
    #define CHECK_ATTR(CMD) \
    memchr_inv((void *) &attr->CMD##_LAST_FIELD + \
       sizeof(attr->CMD##_LAST_FIELD), 0, \
       sizeof(*attr) - \
       offsetof(union bpf_attr, CMD##_LAST_FIELD) - \
       sizeof(attr->CMD##_LAST_FIELD)) != NULL

I doubt initialize-lists worked well.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (ipcs/limits) skip when /proc/sys/kernel is read-only
Karel Zak [Mon, 11 May 2026 09:36:42 +0000 (11:36 +0200)] 
tests: (ipcs/limits) skip when /proc/sys/kernel is read-only

The test writes to /proc/sys/kernel/shm* files which are
read-only in CI containers. Skip the test when the kernel
tunables are not writable.

5 weeks agotests: (bits) quote shell variables
Karel Zak [Mon, 11 May 2026 09:13:20 +0000 (11:13 +0200)] 
tests: (bits) quote shell variables

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'fix/bits_return_value_check' of https://github.com/echoechoin/util...
Karel Zak [Mon, 11 May 2026 09:12:43 +0000 (11:12 +0200)] 
Merge branch 'fix/bits_return_value_check' of https://github.com/echoechoin/util-linux

* 'fix/bits_return_value_check' of https://github.com/echoechoin/util-linux:
  bits: add --fail-width option to reject out-of-range CPU numbers
  bits: add test for invalid token in cpulist_parse()
  bits: improve error message for out-of-range cpulist_parse()
  cpuset: Validate full tokens in cpulist_parse()
  bits: fix return value check for cpulist_parse()

5 weeks agotests: (findmnt) add missing ts_finalize_subtest
Karel Zak [Wed, 6 May 2026 11:34:07 +0000 (13:34 +0200)] 
tests: (findmnt) add missing ts_finalize_subtest

The last subtest "options-no-multi" was missing ts_finalize_subtest
before ts_finalize, detected by the new runtime guard.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: add ts_finalize_subtest before return in functions
Karel Zak [Wed, 6 May 2026 11:29:49 +0000 (13:29 +0200)] 
tests: add ts_finalize_subtest before return in functions

In helper functions that call ts_skip_subtest and then return
early, add ts_finalize_subtest to properly close the subtest
block before returning.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: add ts_finalize_subtest before continue in loops
Karel Zak [Wed, 6 May 2026 11:28:16 +0000 (13:28 +0200)] 
tests: add ts_finalize_subtest before continue in loops

In loops where ts_skip_subtest is called before continue,
add ts_finalize_subtest to properly close the subtest block
before skipping to the next iteration.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: move ts_finalize_subtest after if/else blocks
Karel Zak [Wed, 6 May 2026 11:25:05 +0000 (13:25 +0200)] 
tests: move ts_finalize_subtest after if/else blocks

Move ts_finalize_subtest out of individual if/else branches and
place it unconditionally after the entire block. This enforces
the ts_init_subtest/ts_finalize_subtest pairing introduced in
the previous commit.

Previously, ts_skip_subtest or ts_failed_subtest was used as a
terminal action instead of ts_finalize_subtest. Now each subtest
is a proper init/finalize block, with ts_skip_subtest and
ts_failed_subtest only setting state within the block.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agotests: add subtest status tracking to ts_finalize_subtest
Karel Zak [Wed, 6 May 2026 11:19:11 +0000 (13:19 +0200)] 
tests: add subtest status tracking to ts_finalize_subtest

Add TS_SUBFAILED and TS_SUBSKIPPED flags that are set by
ts_failed_subtest and ts_skip_subtest respectively, and
cleared by ts_init_subtest.

ts_finalize_subtest now checks these flags before running the
diff comparison. If the subtest was already marked as failed or
skipped, it respects that status instead of unconditionally
running ts_gen_diff (which could report OK over a previous
failure).

Remove ts_init_core_env from ts_skip_subtest — environment
reset is now handled exclusively by ts_finalize_subtest, making
ts_init_subtest/ts_finalize_subtest the only paired open/close
for every subtest.

Add runtime guards: ts_init_subtest and ts_finalize both call
ts_failed if TS_SUBNAME is still set from a previous subtest
that was never finalized. This makes missing ts_finalize_subtest
calls a hard test failure, detectable in CI.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agomeson: check slang headers only when slang library is found
Karel Zak [Mon, 4 May 2026 12:15:45 +0000 (14:15 +0200)] 
meson: check slang headers only when slang library is found

The slcurses.h and slang*.h headers were detected unconditionally
in the generic header check loop. When the headers existed on the
system but slang was not actually used (ncurses preferred), irqtop
and cfdisk would include slcurses.h instead of ncurses.h, causing
build failures for ncurses-specific functions like vw_printw() and
resizeterm().

Move slang header checks after slang library detection, guarded by
lib_slang.found(), matching the autotools behavior where these
headers are only checked with --with-slang.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agomeson: rename logindefs_c to lib_common_logindefs
Karel Zak [Mon, 4 May 2026 12:04:34 +0000 (14:04 +0200)] 
meson: rename logindefs_c to lib_common_logindefs

Rename the logindefs static library variable from logindefs_c to
lib_common_logindefs for consistency with lib_common_shells and
the autotools libcommon_logindefs.la naming.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agomeson: split shells.c out of lib_common into lib_common_shells
Karel Zak [Mon, 4 May 2026 12:02:39 +0000 (14:02 +0200)] 
meson: split shells.c out of lib_common into lib_common_shells

Remove shells.c from lib_common_sources and build it as a separate
static library (lib_common_shells) with lib_econf dependency.

Link lib_common_shells only into binaries that use the econf-dependent
shell enumeration functions (is_known_shell, print_shells,
open_etc_shells): chsh, su, runuser, login.

Other binaries that only need ul_default_shell() get it from
lib_common via default_shell.c and don't need libeconf.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agobuild-sys: drop libcommon_shells from binaries that only need ul_default_shell
Karel Zak [Mon, 4 May 2026 11:59:47 +0000 (13:59 +0200)] 
build-sys: drop libcommon_shells from binaries that only need ul_default_shell

Now that ul_default_shell() lives in libcommon, binaries that only
call this function no longer need to link against libcommon_shells
(and transitively libeconf).

Remove libcommon_shells linkage from: flock, unshare, nsenter,
script, scriptlive, more.

Keep libcommon_shells for: login, chsh, su, runuser — these use
is_known_shell(), print_shells() or open_etc_shells() which depend
on libeconf.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agolib: split ul_default_shell() from shells.c into default_shell.c
Karel Zak [Mon, 4 May 2026 11:57:41 +0000 (13:57 +0200)] 
lib: split ul_default_shell() from shells.c into default_shell.c

Move ul_default_shell() and UL_SHELL_* flags into a new
lib/default_shell.c and include/default_shell.h pair, and add the
new file to libcommon (autotools and meson).

ul_default_shell() has no dependency on libeconf -- it simply checks
$SHELL, passwd, and falls back to _PATH_BSHELL. Separating it from
shells.c (which depends on libeconf for /etc/shells enumeration)
allows binaries that only need the default shell lookup (flock,
script, scriptlive, more, exec_shell.c users) to avoid unnecessary
libeconf linkage.

Update callers that only use ul_default_shell() to include
default_shell.h instead of shells.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'obsolete_comment' of https://github.com/serval2412/util-linux
Karel Zak [Mon, 11 May 2026 09:03:13 +0000 (11:03 +0200)] 
Merge branch 'obsolete_comment' of https://github.com/serval2412/util-linux

* 'obsolete_comment' of https://github.com/serval2412/util-linux:
  Remove obsolete comment since 2015

5 weeks agoRemove obsolete comment since 2015
Julien Nabet [Sun, 10 May 2026 08:25:00 +0000 (10:25 +0200)] 
Remove obsolete comment since 2015

after 890e103559ac89b7a0d7a7a71f198e138650ece1

wall: do not use a temporary file.

5 weeks agochrt: improve error message for invalid policy value
Christian Goeschel Ndjomouo [Fri, 8 May 2026 17:41:03 +0000 (13:41 -0400)] 
chrt: improve error message for invalid policy value

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agochrt: remove redundant initializations to 0 in struct members
Christian Goeschel Ndjomouo [Mon, 27 Apr 2026 13:03:33 +0000 (09:03 -0400)] 
chrt: remove redundant initializations to 0 in struct members

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agochrt: deduplicate code for process tasks retrieval
Christian Goeschel Ndjomouo [Tue, 21 Apr 2026 15:39:07 +0000 (11:39 -0400)] 
chrt: deduplicate code for process tasks retrieval

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agochrt: report actual PID in error message when 0 is specified
Christian Goeschel Ndjomouo [Tue, 21 Apr 2026 15:35:25 +0000 (11:35 -0400)] 
chrt: report actual PID in error message when 0 is specified

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agotests: (chrt) simple PID:inode address format test
Christian Goeschel Ndjomouo [Tue, 31 Mar 2026 23:45:02 +0000 (19:45 -0400)] 
tests: (chrt) simple PID:inode address format test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agochrt: support the 'PID:inode' address format
Christian Goeschel Ndjomouo [Tue, 31 Mar 2026 15:38:09 +0000 (11:38 -0400)] 
chrt: support the 'PID:inode' address format

This patch enables support for the PID:inode address format.
It removes a sentinel value from ctl->pid that controls the PID
parsing behavior and introduces a dedicated variable parse_pid
(member of struct chrt_ctl), which makes the code a bit more
readable and coherent.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agotests: (lsfd/mkfds-udp*) make UDPLite related test cases skippable
Masatake YAMATO [Thu, 7 May 2026 21:40:10 +0000 (06:40 +0900)] 
tests: (lsfd/mkfds-udp*) make UDPLite related test cases skippable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (lsfd/option-inet{,-udp}) make UDPLite related test case skippable
Masatake YAMATO [Wed, 6 May 2026 09:39:13 +0000 (18:39 +0900)] 
tests: (lsfd/option-inet{,-udp}) make UDPLite related test case skippable

Fixes #4311

Linux 7.1-rc1 has removed UDP Lite.
In the test case lsfd/option-inet, UDP Lite was must.

This change moves UDPLite related test parts to a new test
case lsfd/option-inet-udp and makes lsfd/option-inet-udp
skippable on the platform where UDPLite is not implemented.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (lsfd) add a function checking the availability of UDPLite socket
Masatake YAMATO [Tue, 5 May 2026 21:19:38 +0000 (06:19 +0900)] 
tests: (lsfd) add a function checking the availability of UDPLite socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (lsfd::mkfds-udp) fix confusion between UDP and UDPLite
Masatake YAMATO [Thu, 7 May 2026 21:21:46 +0000 (06:21 +0900)] 
tests: (lsfd::mkfds-udp) fix confusion between UDP and UDPLite

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
5 weeks agotests: (getino) add missing tests
Christian Goeschel Ndjomouo [Sun, 3 May 2026 03:19:29 +0000 (23:19 -0400)] 
tests: (getino) add missing tests

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 weeks agoCI: replace ntp with ntpsec
Karel Zak [Thu, 7 May 2026 12:34:27 +0000 (14:34 +0200)] 
CI: replace ntp with ntpsec

The ntp package has been removed from Ubuntu repositories.
Use ntpsec as a replacement to provide the sntp command needed
by tests/ts/hwclock/systohc.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 weeks agoMerge branch 'fix/drop_caches_container' of https://github.com/echoechoin/util-linux
Karel Zak [Thu, 7 May 2026 11:44:36 +0000 (13:44 +0200)] 
Merge branch 'fix/drop_caches_container' of https://github.com/echoechoin/util-linux

* 'fix/drop_caches_container' of https://github.com/echoechoin/util-linux:
  tests: skip fallocate/zero-range test when /proc/sys/vm/drop_caches is not writable

5 weeks agoMerge branch 'PR/more-shell-lines' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 7 May 2026 11:12:12 +0000 (13:12 +0200)] 
Merge branch 'PR/more-shell-lines' of https://github.com/karelzak/util-linux-work

* 'PR/more-shell-lines' of https://github.com/karelzak/util-linux-work:
  more: align MORE_SHELL_LINES semantics with less(1)

5 weeks agoMerge branch 'PR/tests-shellcheck-remaining' of https://github.com/karelzak/util...
Karel Zak [Thu, 7 May 2026 11:07:18 +0000 (13:07 +0200)] 
Merge branch 'PR/tests-shellcheck-remaining' of https://github.com/karelzak/util-linux-work

* 'PR/tests-shellcheck-remaining' of https://github.com/karelzak/util-linux-work:
  tests: fix remaining shellcheck warnings

5 weeks agoMerge branch 'PR/sfdisk-no-device-names' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 7 May 2026 11:06:24 +0000 (13:06 +0200)] 
Merge branch 'PR/sfdisk-no-device-names' of https://github.com/karelzak/util-linux-work

* 'PR/sfdisk-no-device-names' of https://github.com/karelzak/util-linux-work:
  tests: add sfdisk --no-device-names regression test
  sfdisk: add --no-device-names option

5 weeks agotests: skip fallocate/zero-range test when /proc/sys/vm/drop_caches is not writable
WanBingjiang [Thu, 7 May 2026 07:27:31 +0000 (15:27 +0800)] 
tests: skip fallocate/zero-range test when /proc/sys/vm/drop_caches is not writable

The build (compat, ubuntu:18.04) CI job runs inside a Docker container
where /proc/sys/vm/drop_caches is read-only. Falling back to fallocate
--report-holes with stale VFS cache yields 0 holes instead of 1, causing
the test to fail.

5 weeks agobits: add --fail-width option to reject out-of-range CPU numbers
WanBingjiang [Thu, 7 May 2026 01:47:25 +0000 (09:47 +0800)] 
bits: add --fail-width option to reject out-of-range CPU numbers

By default, cpulist_parse() silently ignores values wider than the
cpuset size (fail=0).  The new -f/--fail-width flag switches to fail=1,
causing bits to error out with "bit list wider than cpuset size" when
any CPU number exceeds the --width limit.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 weeks agobits: add test for invalid token in cpulist_parse()
WanBingjiang [Wed, 29 Apr 2026 11:08:24 +0000 (19:08 +0800)] 
bits: add test for invalid token in cpulist_parse()

Verify that inputs like 1,2,3abc,4 with trailing garbage after a
valid number are rejected.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 weeks agobits: improve error message for out-of-range cpulist_parse()
WanBingjiang [Wed, 29 Apr 2026 11:00:25 +0000 (19:00 +0800)] 
bits: improve error message for out-of-range cpulist_parse()

Distinguish between invalid list syntax and CPU numbers that exceed
the cpuset size, giving the user a clearer diagnostic.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 weeks agocpuset: Validate full tokens in cpulist_parse()
WanBingjiang [Wed, 29 Apr 2026 03:04:38 +0000 (11:04 +0800)] 
cpuset: Validate full tokens in cpulist_parse()

Prevent silent acceptance of inputs like 1,2,3abc,4 by validating all
characters after each parsed number, not just at the end of the string.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
5 weeks agobits: fix return value check for cpulist_parse()
WanBingjiang [Wed, 29 Apr 2026 02:19:57 +0000 (10:19 +0800)] 
bits: fix return value check for cpulist_parse()

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
6 weeks agodocs: clarify wipefs --force description for partition-table signatures
AndyLau-SOC [Wed, 6 May 2026 12:14:31 +0000 (20:14 +0800)] 
docs: clarify wipefs --force description for partition-table signatures

The current description states that --force "is required in order to erase
a partition-table signature on a block device", which is misleading.
According to the source code (do_wipe() in wipefs.c), --force is needed
for mounted filesystems and for nested partition tables on non-whole-disk
devices, not for all partition tables on all block devices.

Update the text to say "a nested partition-table signature on a non-whole
disk device", consistent with the note earlier in the man page.

Fixes #2447

6 weeks agoMerge branch 'findmnt_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 6 May 2026 11:42:52 +0000 (13:42 +0200)] 
Merge branch 'findmnt_tests' of https://github.com/cgoesche/util-linux-fork

* 'findmnt_tests' of https://github.com/cgoesche/util-linux-fork:
  build: (testcoverage) enable single tool testcoverage check
  tests: (findmnt) add more tests

6 weeks agoMerge branch 'flock' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 6 May 2026 10:23:06 +0000 (12:23 +0200)] 
Merge branch 'flock' of https://github.com/cgoesche/util-linux-fork

* 'flock' of https://github.com/cgoesche/util-linux-fork:
  tests: (flock) adjust commands to better track test coverage

# Conflicts:
# tests/ts/flock/flock

6 weeks agoMerge branch 'more_fallocate_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 6 May 2026 10:02:10 +0000 (12:02 +0200)] 
Merge branch 'more_fallocate_tests' of https://github.com/cgoesche/util-linux-fork

* 'more_fallocate_tests' of https://github.com/cgoesche/util-linux-fork:
  fallocate: (man) mention supported file systems for --insert-range
  tests: (fallocate) add --zero-range and --keep-size test
  tests: (fallocate) add --punch-hole test
  tests: (fallocate) --insert-range test

6 weeks agomore: align MORE_SHELL_LINES semantics with less(1)
Karel Zak [Wed, 6 May 2026 09:58:50 +0000 (11:58 +0200)] 
more: align MORE_SHELL_LINES semantics with less(1)

Change MORE_SHELL_LINES to subtract lines from lines_per_screen
(like LESS_SHELL_LINES in less(1)) rather than setting the absolute
number of lines per screenful.

The block is moved after lines_per_screen is finalized (either from
the default lines_per_page - 1 or from an explicit -n/--lines), so
it correctly adjusts both cases. Values that are zero or would exceed
lines_per_screen are silently ignored.

Addresses: https://github.com/util-linux/util-linux/issues/3476
Co-authored-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agoMerge branch 'enosys_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 6 May 2026 09:47:39 +0000 (11:47 +0200)] 
Merge branch 'enosys_tests' of https://github.com/cgoesche/util-linux-fork

* 'enosys_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: (enosys) add tests for the --dump option
  tests: (enosys) add a simple test for --list

6 weeks agoMerge branch 'chrt_reset_on_fork_test' of https://github.com/cgoesche/util-linux...
Karel Zak [Wed, 6 May 2026 09:41:58 +0000 (11:41 +0200)] 
Merge branch 'chrt_reset_on_fork_test' of https://github.com/cgoesche/util-linux-fork

* 'chrt_reset_on_fork_test' of https://github.com/cgoesche/util-linux-fork:
  tests: (chrt) add --reset-on-fork test
  tests: (helpers) simple tool to create a child process

# Conflicts:
# meson.build
# tests/helpers/Makemodule.am

6 weeks agoMerge branch 'chrt_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Wed, 6 May 2026 09:35:45 +0000 (11:35 +0200)] 
Merge branch 'chrt_tests' of https://github.com/cgoesche/util-linux-fork

* 'chrt_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: (chrt) add test for the --all-tasks option
  tests: (helpers) add a thread creation helper

6 weeks agoMerge branch 'lsfd--ignore-too-large-syscall-args' of https://github.com/masatake...
Karel Zak [Wed, 6 May 2026 09:34:59 +0000 (11:34 +0200)] 
Merge branch 'lsfd--ignore-too-large-syscall-args' of https://github.com/masatake/util-linux

* 'lsfd--ignore-too-large-syscall-args' of https://github.com/masatake/util-linux:
  lsfd: (cosmetic) adjust indent
  lsfd: ignore too large integer read from /proc/PID/syscall
  lsfd: handle unexpected values read from /proc/PID/syscall

6 weeks agotests: add sfdisk --no-device-names regression test
Karel Zak [Tue, 5 May 2026 10:07:56 +0000 (12:07 +0200)] 
tests: add sfdisk --no-device-names regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agosfdisk: add --no-device-names option
Leefancy [Tue, 5 May 2026 10:01:36 +0000 (12:01 +0200)] 
sfdisk: add --no-device-names option

Add --no-device-names option to suppress device names in --dump output,
using partition numbers instead (e.g., "1 : ..." rather than
"/dev/sda1 : ...").

The new libfdisk API:
 - fdisk_script_disable_devnames()
 - fdisk_script_has_devnames()

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

[kzak@redhat.com: - fix gtk-doc comments format
                  - move new symbols to FDISK_2_43
                  - simplify error handling in command_dump
                  - fix man page to mention --dump
                  - move --no-device-names in usage() with --no-* group]

Signed-off-by: Leefancy <lijian01@kylinos.cn>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agobuild: (testcoverage) enable single tool testcoverage check
Christian Goeschel Ndjomouo [Sun, 3 May 2026 21:21:05 +0000 (17:21 -0400)] 
build: (testcoverage) enable single tool testcoverage check

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agotests: (findmnt) add more tests
Christian Goeschel Ndjomouo [Sun, 3 May 2026 20:15:44 +0000 (16:15 -0400)] 
tests: (findmnt) add more tests

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agotests: (enosys) add tests for the --dump option
Christian Goeschel Ndjomouo [Thu, 23 Apr 2026 19:51:02 +0000 (15:51 -0400)] 
tests: (enosys) add tests for the --dump option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agofallocate: (man) mention supported file systems for --insert-range
Christian Goeschel Ndjomouo [Tue, 5 May 2026 13:55:22 +0000 (09:55 -0400)] 
fallocate: (man) mention supported file systems for --insert-range

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agotests: (fallocate) add --zero-range and --keep-size test
Christian Goeschel Ndjomouo [Sat, 2 May 2026 21:57:48 +0000 (17:57 -0400)] 
tests: (fallocate) add --zero-range and --keep-size test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agotests: (fallocate) add --punch-hole test
Christian Goeschel Ndjomouo [Sat, 2 May 2026 18:09:06 +0000 (14:09 -0400)] 
tests: (fallocate) add --punch-hole test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agotests: (fallocate) --insert-range test
Christian Goeschel Ndjomouo [Fri, 1 May 2026 22:25:21 +0000 (18:25 -0400)] 
tests: (fallocate) --insert-range test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 weeks agolib/fileutils: fix fopen_at_no_link() comment formatting
Karel Zak [Tue, 5 May 2026 11:47:32 +0000 (13:47 +0200)] 
lib/fileutils: fix fopen_at_no_link() comment formatting

Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agoMerge branch 'script_toctou' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 5 May 2026 11:40:52 +0000 (13:40 +0200)] 
Merge branch 'script_toctou' of https://github.com/cgoesche/util-linux-fork

* 'script_toctou' of https://github.com/cgoesche/util-linux-fork:
  script: use fopen_at_no_link() for log file opening to prevent TOCTOU
  lib: (fileutils) new fopen_at_no_link routine

6 weeks agoMerge branch 'libfdisk-gpt-numeric-bits-0-2' of https://github.com/JamieMagee/util...
Karel Zak [Tue, 5 May 2026 11:25:47 +0000 (13:25 +0200)] 
Merge branch 'libfdisk-gpt-numeric-bits-0-2' of https://github.com/JamieMagee/util-linux

* 'libfdisk-gpt-numeric-bits-0-2' of https://github.com/JamieMagee/util-linux:
  libfdisk: gpt: drop pointless unsigned >= 0 check
  libfdisk: gpt: use ul_strtou16 for attribute bit parsing
  libfdisk: gpt: accept numeric attribute bits 0-2