Karel Zak [Tue, 28 Apr 2026 12:18:36 +0000 (14:18 +0200)]
Merge branch 'PR/autotools-pkg-config-libs' of https://github.com/karelzak/util-linux-work
* 'PR/autotools-pkg-config-libs' of https://github.com/karelzak/util-linux-work:
autotools: fix AM_CONDITIONAL for HAVE_UDEV and HAVE_AUDIT
autotools,meson: drop unnecessary libm from test_pty
autotools: split MATH_LIBS and ISNAN_LIBS
autotools: use PKG_CHECK_MODULES for zlib
autotools: use PKG_CHECK_MODULES for libcap-ng
autotools: use PKG_CHECK_MODULES for libaudit
autotools: use PKG_CHECK_MODULES for libudev
autotools: use $(MATH_LIBS) instead of -lm for hwclock
autotools: use $(SQLITE3_LIBS) instead of -lsqlite3
autotools: use $(SELINUX_LIBS) instead of -lselinux
autotools: use $(ECONF_LIBS) instead of -leconf
Karel Zak [Tue, 28 Apr 2026 12:17:24 +0000 (14:17 +0200)]
Merge branch 'cross-platform' of https://github.com/t-8ch/util-linux
* 'cross-platform' of https://github.com/t-8ch/util-linux:
treewide: avoid unused argument and missing return warnings in fallbacks
hardlink: (tests) Ignore xattrs
setpgid: (tests) validate presence of /proc/self/stat
tests: show kernel type
Karel Zak [Mon, 27 Apr 2026 10:19:30 +0000 (12:19 +0200)]
autotools: fix AM_CONDITIONAL for HAVE_UDEV and HAVE_AUDIT
Ensure AM_CONDITIONAL is always defined when entering the
else-branch, even when the library is not found. Previously,
when with_udev=auto (default) and libudev was not available,
the conditional was never defined, causing a configure error.
Karel Zak [Thu, 16 Apr 2026 14:19:38 +0000 (16:19 +0200)]
autotools,meson: drop unnecessary libm from test_pty
test_pty only uses pty-session.c and monotonic.c, neither of which
use any math functions. Remove the unnecessary libm dependency from
both autotools and meson build files.
Karel Zak [Thu, 16 Apr 2026 14:13:29 +0000 (16:13 +0200)]
autotools: split MATH_LIBS and ISNAN_LIBS
Separate libm detection into two variables, consistent with how
meson.build handles lib_m vs math_libs:
- MATH_LIBS: unconditional -lm for general math functions (floor,
round, etc.), used by hwclock and test_pty
- ISNAN_LIBS: conditional -lm only when isnan is not available
in libc, used by script, scriptreplay, scriptlive
Previously MATH_LIBS was only set when isnan needed -lm, making it
unreliable for utilities that need other math functions.
Karel Zak [Thu, 16 Apr 2026 13:48:29 +0000 (15:48 +0200)]
autotools: use PKG_CHECK_MODULES for zlib
Replace AC_CHECK_LIB(z) with PKG_CHECK_MODULES to use the pkg-config
module shipped by zlib. This creates $(Z_LIBS) variable, replacing
hardcoded -lz in Makemodule.am files.
Karel Zak [Thu, 16 Apr 2026 13:44:32 +0000 (15:44 +0200)]
autotools: use PKG_CHECK_MODULES for libcap-ng
Replace UL_CHECK_LIB(cap-ng) with PKG_CHECK_MODULES to use the
pkg-config module shipped by libcap-ng. This creates $(CAP_NG_LIBS)
variable, replacing hardcoded -lcap-ng in Makemodule.am files.
Karel Zak [Thu, 16 Apr 2026 13:33:47 +0000 (15:33 +0200)]
autotools: use PKG_CHECK_MODULES for libaudit
Replace UL_CHECK_LIB(audit) with PKG_CHECK_MODULES to use the
pkg-config module shipped by libaudit. This creates $(AUDIT_LIBS)
variable, replacing hardcoded -laudit in Makemodule.am files.
Karel Zak [Thu, 16 Apr 2026 13:31:55 +0000 (15:31 +0200)]
autotools: use PKG_CHECK_MODULES for libudev
Replace UL_CHECK_LIB(udev) with PKG_CHECK_MODULES to use the
pkg-config module shipped by libudev. This creates $(UDEV_LIBS)
variable, replacing hardcoded -ludev in Makemodule.am files.
Karel Zak [Thu, 16 Apr 2026 13:07:36 +0000 (15:07 +0200)]
autotools: use $(ECONF_LIBS) instead of -leconf
Use the pkg-config variable set by PKG_CHECK_MODULES in configure.ac
rather than hardcoding -leconf. This is consistent with how setpriv
already links libeconf and ensures correct flags from pkg-config.
Karel Zak [Tue, 28 Apr 2026 09:15:35 +0000 (11:15 +0200)]
Merge branch 'PR/ci-fix-po4a-build' of https://github.com/karelzak/util-linux-work
* 'PR/ci-fix-po4a-build' of https://github.com/karelzak/util-linux-work:
ci: install libunicode-linebreak-perl for po4a translations
ci: fix CodeQL build failure due to missing po4a dependency
Karel Zak [Tue, 28 Apr 2026 08:49:13 +0000 (10:49 +0200)]
Merge branch 'macos-prep' of https://github.com/t-8ch/util-linux
* 'macos-prep' of https://github.com/t-8ch/util-linux:
libsmartcols: Ignore -Wsign-compare in filter-scanner.l
flock: (test) Only test fcntl vs flock on Linux
meson: (libfdisk, libsmartcols, libmount) handle linkers without version script support
hardlink: handle ENOTDIR from nftw() on a file
Karel Zak [Tue, 28 Apr 2026 07:55:50 +0000 (09:55 +0200)]
Merge branch 'runuser_regression' of https://github.com/cgoesche/util-linux-fork
* 'runuser_regression' of https://github.com/cgoesche/util-linux-fork:
su-common: revert "su: pass arguments after <user> to shell"
tests: add regression tests for runuser
Karel Zak [Mon, 27 Apr 2026 12:31:47 +0000 (14:31 +0200)]
ci: install libunicode-linebreak-perl for po4a translations
The distcheck job fails because po4a requires the
Unicode::GCString Perl module (provided by
libunicode-linebreak-perl) to detect two-line titles
in AsciiDoc files.
Karel Zak [Mon, 27 Apr 2026 12:29:51 +0000 (14:29 +0200)]
ci: fix CodeQL build failure due to missing po4a dependency
Replace the autobuild action with a custom build step that
disables document translation. The autobuild auto-installed
po4a but the environment lacks the Unicode::GCString Perl
module, causing the translation step to fail. CodeQL analysis
does not need translated man pages.
dmesg: fix out-of-bounds read when parsing malformed kmsg file
Add bounds check to LAST_KMSG_FIELD macro to prevent accessing
memory before the buffer start, and null-terminate the record
buffer in print_kmsg_file() to stop string functions from reading
past the valid data.
Commit ac0147f added '+' to the getopt(3) option string which
allowed the passing of all arguments after a non-option arg
to be passed to the invoked shell, in this case after <user>.
However, this introduced a regression in runuser(1) and su(1)
where options for both utilities are scattered before and after
the username. E.g.: "su <user> -c 'echo foo' -s /bin/bash" will
pass both -c and -s argument sets to the invoked shell instead
of simply passing -c 'echo foo'.
Note that this behavior is more common in BSD/macOS-style
implementations of su(1), in a future commit this behavior will
be added more sensibly and carefully.
Addresses: ac0147f Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Karel Zak [Mon, 27 Apr 2026 11:09:43 +0000 (13:09 +0200)]
Merge branch 'PR/agetty-credentials' of https://github.com/karelzak/util-linux-work
* 'PR/agetty-credentials' of https://github.com/karelzak/util-linux-work:
agetty: add support for more systemd credentials
agetty: add cred_read_bool() for credential boolean parsing
agetty: add cred_read_num() for credential numeric parsing
agetty: add cred_read_str() for credential string parsing
Karel Zak [Mon, 27 Apr 2026 10:34:50 +0000 (12:34 +0200)]
Merge branch 'manpages_term_consistency' of https://github.com/cgoesche/util-linux-fork
* 'manpages_term_consistency' of https://github.com/cgoesche/util-linux-fork:
man: use the term 'calling process' instead of 'current process'
man: use the term unprivileged instead of non-root
man: (mount) fix minor term inconsistency
man: use symbolic link instead of symlink
man: use superblock term consistently
man: use the term 'real-time' more consistently
man: use 'pseudoterminal' instead of 'pseudo[- ]terminal'
man: use 'pathname' instead of 'path name'
man: use 'nonzero' instead of 'non-zero'
man: use 'uppercase' instead of 'upper case'
man: use 'lowercase' instead of 'lower case'
man: (lastlog) fix minor wording inconsistency
man: use 'filesystem(s)' instead of 'file system(s)'
man: use 'filename(s)' instead of 'file name(s)'
man: use 'Epoch' instead of 'epoch'
man: use 'built-in' instead of 'builtin'
man: use 'bit mask' instead of 'bitmask'
Karel Zak [Mon, 27 Apr 2026 09:37:19 +0000 (11:37 +0200)]
Merge branch 'fix/4157' of https://github.com/echoechoin/util-linux
* 'fix/4157' of https://github.com/echoechoin/util-linux:
liblastlog2: declare variables at the top of the block
liblastlog2: register journal mode man pages in build system
lastlog2: add --journal option to manage SQLite journal mode
liblastlog2: add support for WAL journal mode
Alessandro Ratti [Fri, 27 Mar 2026 14:40:49 +0000 (15:40 +0100)]
lsblk: move source files to dedicated lsblk-cmd/ directory
Move all lsblk source files from misc-utils/ to a dedicated
lsblk-cmd/ directory, following the pattern established by lsfd-cmd/.
Update both autotools and meson build systems accordingly.
lastlog2: add --journal option to manage SQLite journal mode
Add -j/--journal option to the lastlog2 command to allow users to
view and set the SQLite journal mode. Without an argument, it displays
the current mode. With an argument, it sets the mode to the specified
value (WAL, DELETE, TRUNCATE, PERSIST, MEMORY, OFF).
The option supports flexible argument formats:
- Short option with space: -j WAL
- Short option without space: -jWAL
- Long option with equals: --journal=WAL
Also update bash-completion to provide journal mode suggestions and
add documentation to the man page with usage examples.
Add ll2_set_journal_mode() and ll2_get_journal_mode() functions to
allow setting and querying SQLite journal modes. This enables users
to switch to WAL (Write-Ahead Logging) mode for better concurrency
in high-traffic scenarios.
WAL mode allows readers and writers to operate concurrently without
blocking each other, significantly reducing database lock contention
in environments with frequent SSH logins.
The journal mode setting is persistent and only needs to be set once
per database.
Karel Zak [Wed, 15 Apr 2026 13:53:56 +0000 (15:53 +0200)]
libblkid: nilfs: fix byte order and block size validation
Fix s_dev_size comparison to use le64_to_cpu() for big-endian
architectures. Tighten s_log_block_size check to match kernel limit
(NILFS_MAX_BLOCK_SIZE=65536, max shift 6).
Karel Zak [Wed, 15 Apr 2026 13:48:09 +0000 (15:48 +0200)]
libblkid: udf: cap descriptor sequence iteration count
The descriptor count is derived from attacker-controlled anchor length
and has no upper bound. Cap at 64 -- a UDF volume descriptor sequence
contains only a handful of descriptors (PVD, LVD, USD, IUVD, TD, ...),
similar to the kernel's UDF_MAX_TD_NESTING limit in fs/udf/super.c.
Karel Zak [Wed, 22 Apr 2026 10:23:37 +0000 (12:23 +0200)]
agetty: add cred_read_bool() for credential boolean parsing
Introduce cred_read_bool() helper that reads a systemd credential
file and parses the value as a boolean using ul_strtobool(). The
invert argument allows handling "noissue"-style credentials where
true means the flag should be cleared rather than set.
Addresses: https://github.com/util-linux/util-linux/issues/2255 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 22 Apr 2026 10:21:50 +0000 (12:21 +0200)]
agetty: add cred_read_num() for credential numeric parsing
Introduce cred_read_num() helper that reads a systemd credential
file and parses the value as a number. The type argument selects
between unsigned ('u') and signed ('d') parsing, making it easy
to extend for other numeric types in the future.
Addresses: https://github.com/util-linux/util-linux/issues/2255 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 22 Apr 2026 10:18:08 +0000 (12:18 +0200)]
agetty: add cred_read_str() for credential string parsing
Introduce cred_read_str() helper that reads a systemd credential
file and stores the string value into a struct member addressed
via offsetof(). This replaces the open-coded string credential
handling and prepares for adding more credential types.
Addresses: https://github.com/util-linux/util-linux/issues/2255 Signed-off-by: Karel Zak <kzak@redhat.com>
lslogins: use new lib functions for user/group name parsing
This patch makes use of the new ul_get{grp,userpw}_str lib
functions to parse user/group names passed to the --logins
and --groups options. The use of these functions simplifies
the code base and makes str_to_uint() useless, therefore we
can remove it.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>