]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 months agolsfd: (tests) drop suffix variable in lsfd_check_sockdiag
Thomas Weißschuh [Wed, 20 May 2026 07:54:36 +0000 (09:54 +0200)] 
lsfd: (tests) drop suffix variable in lsfd_check_sockdiag

It is not used anymore.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotests: use ts_skip_config where appropriate
Thomas Weißschuh [Tue, 19 May 2026 20:52:42 +0000 (22:52 +0200)] 
tests: use ts_skip_config where appropriate

Replace the open-coded implementations with the proper helper.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotests: fold ts_failed_subtest into ts_failed
Thomas Weißschuh [Tue, 19 May 2026 20:54:44 +0000 (22:54 +0200)] 
tests: fold ts_failed_subtest into ts_failed

The differences between ts_failed_subtest and ts_failed are miniminal.
Make ts_failed usable from subtest context and remove the now unnecessary
ts_failed_subtest.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotests: fold ts_skip_subtest into ts_skip
Thomas Weißschuh [Tue, 19 May 2026 20:46:01 +0000 (22:46 +0200)] 
tests: fold ts_skip_subtest into ts_skip

The differences between ts_skip_subtest and ts_skip are miniminal.
Make ts_skip usable from subtest context and remove the now unnecessary
ts_skip_subtest.

This allows subtests to make use of all of the convenient helpers built
around ts_skip.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agolibmount: (tests) skip btrfs test if btrfs support is not enabled
Thomas Weißschuh [Mon, 18 May 2026 16:09:45 +0000 (18:09 +0200)] 
libmount: (tests) skip btrfs test if btrfs support is not enabled

btrfs support in libmount is optional. If it is not enabled, the test
will fail. Skip the test in that case.

Fixes: 4583d15248fd ("tests: add btrfs RAID is-mounted test for libmount")
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotests: (cramfs) restore umask after creating test input files
Leonid Znamenok [Tue, 19 May 2026 18:41:57 +0000 (22:41 +0400)] 
tests: (cramfs) restore umask after creating test input files

The cramfs doubles/mkfs/mkfs-endianness tests set "umask 133" to get
deterministic permission bits on the test input files. The umask was
never restored, so it stayed in effect for every command run later in
the test, including the build-tree mount/umount/mkfs.cramfs helpers.

When such a helper is a libtool wrapper script that has to relink its
real binary on first use (fast_install=yes), the relink runs under the
leaked umask 133 and the resulting .libs/lt-* binary is created without
execute bits (mode 0644). The wrapper then fails to exec it with
"Permission denied" (EACCES). Because the broken binary is cached, every
subsequent test using that helper fails as well:

exec: .../.libs/lt-mount: cannot execute: Permission denied

Save and restore the umask so it only covers creation of the test input
files and does not affect helper invocations.

2 months agopam_lastlog2: fix libpam linking in autotools build
Karel Zak [Tue, 19 May 2026 08:54:57 +0000 (10:54 +0200)] 
pam_lastlog2: fix libpam linking in autotools build

Move -lpam from LDFLAGS to LIBADD. When -lpam is in LDFLAGS it
appears on the linker command line before object files, so the
--as-needed linker flag (default on Fedora) discards it before
seeing any undefined PAM symbols. This results in pam_lastlog2.so
missing libpam.so in its ELF NEEDED entries.

The module then fails to load with dlopen() if the calling process
does not itself link against libpam (e.g., systemd in Fedora 44+):

  PAM unable to dlopen(pam_lastlog2.so): undefined symbol: pam_syslog

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2453457
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolibblkid: (dasd) remove unnecessary 'rc' variable
Karel Zak [Tue, 19 May 2026 08:28:21 +0000 (10:28 +0200)] 
libblkid: (dasd) remove unnecessary 'rc' variable

Return probe results directly instead of storing in an
intermediate variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolibblkid: (dasd) guard against uint64 underflow in LDL size calculation
Karel Zak [Tue, 19 May 2026 08:18:44 +0000 (10:18 +0200)] 
libblkid: (dasd) guard against uint64 underflow in LDL size calculation

When an LDL volume label has ldl_version < 0xf2, the partition
size is derived from the device size. If the device is smaller
than the partition start offset (3 blocks), the subtraction
wraps around producing a bogus partition size.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolibblkid: (dasd) add buffer size guards to helper functions
Karel Zak [Tue, 19 May 2026 08:12:41 +0000 (10:12 +0200)] 
libblkid: (dasd) add buffer size guards to helper functions

Add explicit buffer size parameters to dasd_get_volser(),
dasd_get_dsnam(), is_dasd_cdl_label(), is_dasd_ldl_label()
and is_dasd_f4_label() so that these functions can protect
against buffer overflows without relying on callers to pass
correctly sized buffers.

The conversion functions still follow the DASD standard field
sizes (DASD_VOLSER_LENGTH, sizeof DS1DSNAM), but clamp to the
buffer size as a safety net. The label detection functions
derive their minimum sizes from the actual struct offsets and
magic constants rather than hardcoded numbers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolibblkid: (dasd) use rtrim_whitespace() for EBCDIC string trimming
Karel Zak [Tue, 19 May 2026 07:49:32 +0000 (09:49 +0200)] 
libblkid: (dasd) use rtrim_whitespace() for EBCDIC string trimming

Replace hand-rolled trailing-space trim loops in dasd_get_volser()
and dasd_get_dsnam() with rtrim_whitespace() from strutils.h.

The original dasd_get_volser() loop had no lower-bound guard and
would read out-of-bounds if all VOLSER bytes were spaces.

Addresses: https://github.com/util-linux/util-linux/pull/4096

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'master_libblkid-dasd-support' of https://github.com/vojtechtrefny/util...
Karel Zak [Tue, 19 May 2026 08:31:52 +0000 (10:31 +0200)] 
Merge branch 'master_libblkid-dasd-support' of https://github.com/vojtechtrefny/util-linux

* 'master_libblkid-dasd-support' of https://github.com/vojtechtrefny/util-linux:
  libblkid: Add support for DASD partition table

2 months agotests: test_scols_termreduce needs libsmartcols
Adam Sampson [Mon, 18 May 2026 13:41:40 +0000 (14:41 +0100)] 
tests: test_scols_termreduce needs libsmartcols

This helper needs libsmartcols, so it can't be built if util-linux is
configured with --disable-libsmartcols. (It's still reasonable to want
to run the test suite in this case, for example if you're configuring
util-linux to only build libuuid.)

Signed-off-by: Adam Sampson <ats@offog.org>
2 months agoMerge branch 'macos' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 18 May 2026 09:59:17 +0000 (11:59 +0200)] 
Merge branch 'macos' of https://github.com/t-8ch/util-linux

* 'macos' of https://github.com/t-8ch/util-linux:
  ci: add a macos workflow
  test_threads_create: add a macOS fallback
  meson: gate test_child_create on sys/prctl.h
  ctrlaltdel: pass correct integer types to printf
  meson: gate irqtop on sys/epoll.h and cpu_set_t
  meson: gate lsirq on cpu_set_t
  meson: gate lsipc on LINUX
  meson: gate pivot_root on LINUX
  meson: gate lscpu on LINUX and cpu_set_t
  meson: add build-lscpu option

2 months agoMerge branch 'getino_tests_v2' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 18 May 2026 09:39:23 +0000 (11:39 +0200)] 
Merge branch 'getino_tests_v2' of https://github.com/cgoesche/util-linux-fork

* 'getino_tests_v2' of https://github.com/cgoesche/util-linux-fork:
  tests: (getino) minor code simplification

2 months agoMerge branch 'fincore_test' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 18 May 2026 09:36:24 +0000 (11:36 +0200)] 
Merge branch 'fincore_test' of https://github.com/cgoesche/util-linux-fork

* 'fincore_test' of https://github.com/cgoesche/util-linux-fork:
  tests: (fincore) add --cachestat option test
  fincore: define HAVE_CACHESTAT on fallback

2 months agoreadprofile: (man) clarify not designed for privilege-elevation use
Karel Zak [Mon, 18 May 2026 08:45:20 +0000 (10:45 +0200)] 
readprofile: (man) clarify not designed for privilege-elevation use

Add a note to the DESCRIPTION that readprofile is a diagnostic tool
not intended for security-sensitive contexts (setuid, setgid, sudo).
Remove the suggestion to make readprofile set-user-ID 0 from the -r
option, and drop sudo from the example.

2 months agolicense: switch from BSD 4-clause to 3-clause
ionmeo [Wed, 13 May 2026 15:57:11 +0000 (11:57 -0400)] 
license: switch from BSD 4-clause to 3-clause

Remove the advertising clause (clause 3) and renumber the
non-endorsement clause from 4 to 3 in all files containing the
BSD 4-clause license, following the notice issued by UC Berkeley
(quoted below).

Additional changes:
- Add SPDX-License-Identifier: BSD-3-Clause to each affected file.
- Remove the BSD-4-Clause-UC entry from README.licensing.
- Delete Documentation/licenses/COPYING.BSD-4-Clause-UC.

Reference:
https://ipira.berkeley.edu/sites/default/files/amendment_of_4-clause_bsd_software_license.pdf

Relevant text:

    January 31, 2012

    To all licensees, and distributors of software officially
    licensed under a UC Berkeley version of the BSD license:

    As you may know, certain software officially licensed by UC
    Berkeley using the original 4-clause BSD license required that
    further distributions of products containing all or portions of
    the software acknowledge within their advertising materials that
    such products contain software developed by UC Berkeley and its
    contributors.

    Specifically, the provision reads:

        "3. All advertising materials mentioning features or use of
        this software must display the following acknowledgement:
        This product includes software developed by the University
        of California, Berkeley and its contributors."

    Effective immediately, licensees and distributors are no longer
    required to include the acknowledgement within advertising
    materials. Accordingly, the advertising clause 3 of the original
    4-clause BSD license for any and all software officially licensed
    by UC Berkeley, is hereby deleted in its entirety.

    Michael Katz
    Executive Director
    Intellectual Property and Industry Research Alliances
    University of California, Berkeley

2 months agoUpdate schedutils/chrt.c
1frn10 [Thu, 14 May 2026 18:36:19 +0000 (21:36 +0300)] 
Update schedutils/chrt.c

Co-authored-by: Christian Goeschel Ndjomouo <162830835+cgoesche@users.noreply.github.com>
2 months agoUpdate schedutils/chrt.c
1frn10 [Thu, 14 May 2026 18:35:37 +0000 (21:35 +0300)] 
Update schedutils/chrt.c

Co-authored-by: Christian Goeschel Ndjomouo <162830835+cgoesche@users.noreply.github.com>
2 months agotests: (getino) minor code simplification
Christian Goeschel Ndjomouo [Wed, 13 May 2026 22:12:33 +0000 (18:12 -0400)] 
tests: (getino) minor code simplification

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agochrt: Add support for SCHED_FLAG_UTIL_CLAMP
Furkan Caliskan [Thu, 14 May 2026 11:52:22 +0000 (14:52 +0300)] 
chrt: Add support for SCHED_FLAG_UTIL_CLAMP

The SCHED_FLAG_UTIL_CLAMP_MIN and SCHED_FLAG_UTIL_CLAMP_MAX flags
allow users to set utilization hints for tasks. The minimum clamp
tells the scheduler to place the task on a CPU with enough capacity,
while the maximum clamp prevents unnecessary CPU frequency boosting.
Both accept a value in the range 0-1024, where 1024 represents 100%
of maximum CPU capacity. Mainly useful on heterogeneous systems.

Add -U/--clamp-min and -X/--clamp-max options to allow users to
set these hints for any scheduling policy.

Closes: https://github.com/util-linux/util-linux/issues/4339
Signed-off-by: Furkan Caliskan <frn1furkan10@gmail.com>
2 months agotests: (fincore) add --cachestat option test
Christian Goeschel Ndjomouo [Sun, 3 May 2026 01:04:06 +0000 (21:04 -0400)] 
tests: (fincore) add --cachestat option test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agoci: add a macos workflow
Thomas Weißschuh [Sun, 12 Apr 2026 06:01:51 +0000 (08:01 +0200)] 
ci: add a macos workflow

Some users want to build parts of util-linux on macOS.
Add a workflow to make sure this works.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotest_threads_create: add a macOS fallback
Thomas Weißschuh [Wed, 13 May 2026 13:56:09 +0000 (15:56 +0200)] 
test_threads_create: add a macOS fallback

SYS_gettid is Linux-specific. Add a fallback for macOS.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate test_child_create on sys/prctl.h
Thomas Weißschuh [Wed, 13 May 2026 13:48:34 +0000 (15:48 +0200)] 
meson: gate test_child_create on sys/prctl.h

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agoctrlaltdel: pass correct integer types to printf
Thomas Weißschuh [Wed, 22 Apr 2026 21:40:51 +0000 (23:40 +0200)] 
ctrlaltdel: pass correct integer types to printf

The printf format %ju expects an 'uintmax_t'. Cast the value to make
sure the correct type is passed.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate irqtop on sys/epoll.h and cpu_set_t
Thomas Weißschuh [Wed, 29 Apr 2026 12:05:53 +0000 (14:05 +0200)] 
meson: gate irqtop on sys/epoll.h and cpu_set_t

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate lsirq on cpu_set_t
Thomas Weißschuh [Wed, 29 Apr 2026 12:07:56 +0000 (14:07 +0200)] 
meson: gate lsirq on cpu_set_t

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate lsipc on LINUX
Thomas Weißschuh [Wed, 29 Apr 2026 12:30:00 +0000 (14:30 +0200)] 
meson: gate lsipc on LINUX

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate pivot_root on LINUX
Thomas Weißschuh [Wed, 29 Apr 2026 11:56:11 +0000 (13:56 +0200)] 
meson: gate pivot_root on LINUX

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: gate lscpu on LINUX and cpu_set_t
Thomas Weißschuh [Wed, 29 Apr 2026 11:37:45 +0000 (13:37 +0200)] 
meson: gate lscpu on LINUX and cpu_set_t

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

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: add build-lscpu option
Thomas Weißschuh [Wed, 29 Apr 2026 11:36:32 +0000 (13:36 +0200)] 
meson: add build-lscpu 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>
2 months agoagetty: move fakehost to struct agetty_options
Karel Zak [Thu, 14 May 2026 10:13:39 +0000 (12:13 +0200)] 
agetty: move fakehost to struct agetty_options

Move the file-scope fakehost variable into struct agetty_options
and drop the separate fakehost parameter from agetty_update_utmp()
and agetty_init_login_argv().

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: make longopts[] static const
Karel Zak [Thu, 14 May 2026 10:07:23 +0000 (12:07 +0200)] 
agetty: make longopts[] static const

The getopt long options array is read-only, use static const
to avoid re-initializing it on every parse_args() call.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move usage() and parse_args() before main()
Karel Zak [Thu, 14 May 2026 10:06:12 +0000 (12:06 +0200)] 
agetty: move usage() and parse_args() before main()

Reorder functions so that output_version(), usage() and
parse_args() appear before main(), matching the convention used
across the project. Remove the now unnecessary forward
declarations for these functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: clean up includes in agetty.c
Karel Zak [Thu, 14 May 2026 10:03:39 +0000 (12:03 +0200)] 
agetty: clean up includes in agetty.c

Remove headers that are no longer needed after splitting functions
to separate files. Sort remaining includes alphabetically.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: add public domain header to all source files
Karel Zak [Thu, 14 May 2026 10:00:25 +0000 (12:00 +0200)] 
agetty: add public domain header to all source files

Replace "This program is freely distributable." with the standard
public domain notice used across the project.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: remove duplicate ISSUEDIR_EXT from agetty.c
Karel Zak [Thu, 14 May 2026 09:55:10 +0000 (11:55 +0200)] 
agetty: remove duplicate ISSUEDIR_EXT from agetty.c

The ISSUEDIR_EXT and ISSUEDIR_EXTSIZ macros are only used in
issuefile.c, remove the unused duplicate from agetty.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move login argv initialization to utils.c
Karel Zak [Thu, 14 May 2026 09:54:01 +0000 (11:54 +0200)] 
agetty: move login argv initialization to utils.c

Introduce agetty_init_login_argv() that consolidates the login
command line setup: setting the program name, check_username(),
login_options_to_argv() with replace_u(), and the -h/-H/-f/--
flag logic.

Move LOGIN_ARGV_MAX to the shared header. The check_username(),
login_options_to_argv() and replace_u() helpers become static
in utils.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move username to struct agetty_options
Karel Zak [Thu, 14 May 2026 09:47:32 +0000 (11:47 +0200)] 
agetty: move username to struct agetty_options

Move the username variable from a main() local into struct
agetty_options to make it accessible from helper functions
without passing it separately.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move parse_speeds() to utils.c
Karel Zak [Thu, 14 May 2026 09:38:27 +0000 (11:38 +0200)] 
agetty: move parse_speeds() to utils.c

Rename to agetty_parse_speeds() and move to utils.c alongside
the other parsing helpers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move init_special_char() to utils.c
Karel Zak [Thu, 14 May 2026 09:33:15 +0000 (11:33 +0200)] 
agetty: move init_special_char() to utils.c

Rename to agetty_parse_initstring() and change the interface to
return the parsed string instead of modifying struct agetty_options
directly.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move FIRST_SPEED to tty.c
Karel Zak [Thu, 14 May 2026 09:26:10 +0000 (11:26 +0200)] 
agetty: move FIRST_SPEED to tty.c

FIRST_SPEED is only used in tty.c, no need to expose it in the
shared header.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: use bool for struct agetty_issue bitfields
Karel Zak [Thu, 14 May 2026 09:24:27 +0000 (11:24 +0200)] 
agetty: use bool for struct agetty_issue bitfields

Replace the unsigned int bitfields do_tcsetattr and do_tcrestore
with bool, matching the project's direction of using boolean types.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: split out issue file functions to issuefile.c
Karel Zak [Thu, 14 May 2026 09:21:48 +0000 (11:21 +0200)] 
agetty: split out issue file functions to issuefile.c

Move issue file parsing, display and reload functions to a new
issuefile.c file: agetty_print_issue_file(), agetty_eval_issue_file(),
agetty_show_issue(), agetty_issue_is_changed(), agetty_reload(),
read_os_release(), output_special_char(), and all issuedir/issuefile
read helpers and network interface display functions.

Keep do_prompt(), get_logname() and wait_for_term_input() in
agetty.c as they are tightly coupled to the main login flow.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move struct issue and related defines to agetty.h
Karel Zak [Thu, 14 May 2026 09:11:01 +0000 (11:11 +0200)] 
agetty: move struct issue and related defines to agetty.h

Move struct issue (renamed to struct agetty_issue),
ISSUE_SUPPORT, ISSUEDIR_SUPPORT, AGETTY_RELOAD and USE_NETLINK
defines to the shared header file in preparation for splitting
the issue file functions to a separate source file.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: split out terminal functions to tty.c
Karel Zak [Thu, 14 May 2026 08:57:21 +0000 (10:57 +0200)] 
agetty: split out terminal functions to tty.c

Move terminal initialization and management functions to tty.c:
agetty_open_tty(), agetty_termio_clear(), agetty_termio_init(),
agetty_termio_final(), agetty_reset_vc(), agetty_auto_baud(),
agetty_next_speed() and agetty_erase_char().

Move CLOCAL_MODE_* enum, FIRST_SPEED and debug() macro to agetty.h
as they are now needed by multiple source files.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: split out speed table and baud code to tty.c
Karel Zak [Thu, 14 May 2026 08:37:35 +0000 (10:37 +0200)] 
agetty: split out speed table and baud code to tty.c

Move speedtab[], struct Speedtab, bcode() and list_speeds() to a
new tty.c file as agetty_bcode() and agetty_list_speeds(). The
speed table is kept static in tty.c.

Add agetty_fprint_speed() to print the numeric baud rate for a
given speed code, replacing the open-coded speedtab[] lookup in
output_special_char() case 'b'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move utility functions to utils.c
Karel Zak [Thu, 14 May 2026 08:08:30 +0000 (10:08 +0200)] 
agetty: move utility functions to utils.c

Move agetty_update_utmp(), agetty_xgethostname() and
agetty_xgetdomainname() to utils.c.

Move the SYSV_STYLE detection to agetty.h so it is available to
all split-out files. Change agetty_update_utmp() to take fakehost
as a parameter instead of accessing a file-scope static variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: split out credential loading to credentials.c
Karel Zak [Thu, 14 May 2026 07:47:38 +0000 (09:47 +0200)] 
agetty: split out credential loading to credentials.c

Move agetty_load_credentials() and its helpers (cred_read_str,
cred_read_num, cred_read_bool) to a new credentials.c file.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move struct options and F_* flags to agetty.h
Karel Zak [Thu, 14 May 2026 07:41:12 +0000 (09:41 +0200)] 
agetty: move struct options and F_* flags to agetty.h

Move struct options (renamed to struct agetty_options), MAX_SPEED
and all F_* flag definitions to the shared header file, making
them available to the split-out source files.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: split out logging functions to utils.c
Karel Zak [Wed, 13 May 2026 13:18:13 +0000 (15:18 +0200)] 
agetty: split out logging functions to utils.c

Move dolog(), agetty_exit_slowly(), agetty_log_err() and
agetty_log_warn() to a new utils.c file. These are foundational
functions used throughout agetty and need to be available to all
the split-out files.

Rename with agetty_ prefix to avoid symbol name collisions now
that the functions are no longer static.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: add initial agetty.h header file
Karel Zak [Wed, 13 May 2026 13:09:12 +0000 (15:09 +0200)] 
agetty: add initial agetty.h header file

Add an empty header file to be populated incrementally as functions
are split out from the monolithic agetty.c into separate files.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoagetty: move agetty.c to agetty-cmd/ directory
Karel Zak [Wed, 13 May 2026 13:02:27 +0000 (15:02 +0200)] 
agetty: move agetty.c to agetty-cmd/ directory

Create a dedicated agetty-cmd/ directory and move the monolithic
agetty.c there as a first step towards splitting it into smaller,
more maintainable files.

Update both autotools and meson build systems accordingly.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'PR/write-utmp-and-cleanup' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 14 May 2026 11:05:12 +0000 (13:05 +0200)] 
Merge branch 'PR/write-utmp-and-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/write-utmp-and-cleanup' of https://github.com/karelzak/util-linux-work:
  write: cleanup indentation and whitespace
  write: use mem2strcpy() for utmp strings
  write: always use utmp as fallback

2 months agoMerge branch 'chrt-dl-overrun' of https://github.com/1frn10/util-linux-fork
Karel Zak [Thu, 14 May 2026 10:37:13 +0000 (12:37 +0200)] 
Merge branch 'chrt-dl-overrun' of https://github.com/1frn10/util-linux-fork

* 'chrt-dl-overrun' of https://github.com/1frn10/util-linux-fork:
  chrt: Add support for SCHED_FLAG_DL_OVERRUN

2 months agomount: (man) Fix grammar mistake on conv option
Eleftherios Kourmpalidis [Sun, 10 May 2026 14:18:49 +0000 (14:18 +0000)] 
mount: (man) Fix grammar mistake on conv option

Signed-off-by: Eleftherios Kourmpalidis <lefteriskourbal@gmail.com>
2 months agofincore: define HAVE_CACHESTAT on fallback
Christian Goeschel Ndjomouo [Sun, 3 May 2026 00:02:03 +0000 (20:02 -0400)] 
fincore: define HAVE_CACHESTAT on fallback

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agochrt: Add support for SCHED_FLAG_DL_OVERRUN
Furkan Caliskan [Wed, 13 May 2026 09:45:09 +0000 (12:45 +0300)] 
chrt: Add support for SCHED_FLAG_DL_OVERRUN

When set on a SCHED_DEADLINE task, the kernel sends SIGXCPU to the
task if it exceeds its runtime budget within a period. Without this
flag the task is silently throttled until the next period. Useful
for real-time applications that need to detect when they are not
meeting their timing requirements.

Add -O/--deadline-overrun option to allow users to toggle this
feature using the deadline scheduling class.

Signed-off-by: Furkan Caliskan <frn1furkan10@gmail.com>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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

2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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

2 months 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

2 months 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>
2 months 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

2 months 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

2 months 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>
2 months 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>