]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 months agomeson: gate liblastlog2 on lastlog.h
Thomas Weißschuh [Wed, 22 Apr 2026 20:51:53 +0000 (22:51 +0200)] 
meson: gate liblastlog2 on lastlog.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: test for headers earlier
Thomas Weißschuh [Wed, 22 Apr 2026 20:51:43 +0000 (22:51 +0200)] 
meson: test for headers earlier

Some upcoming changes will require the header test results earlier, move
them up. Also remove all the conditional header tests, there is no
downside to always test for all of them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agosulogin: guard oneline() behind __linux__
Thomas Weißschuh [Wed, 22 Apr 2026 21:01:28 +0000 (23:01 +0200)] 
sulogin: guard oneline() behind __linux__

This function is only used on Linux, so also put it behind the ifdef to
avoid an unused function otherwise.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agomeson: respect build-dmesg for test_dmesg
Thomas Weißschuh [Wed, 22 Apr 2026 21:29:00 +0000 (23:29 +0200)] 
meson: respect build-dmesg for test_dmesg

If dmesg can not be built, test_dmesg can't be either.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agotests: add EACCES errno to test_strerror
Christian Goeschel Ndjomouo [Sun, 3 May 2026 04:19:52 +0000 (00:19 -0400)] 
tests: add EACCES errno to test_strerror

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agotests: (flock) adjust commands to better track test coverage
Christian Goeschel Ndjomouo [Sun, 3 May 2026 01:31:20 +0000 (21:31 -0400)] 
tests: (flock) adjust commands to better track test coverage

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agolibfdisk: gpt: accept numeric attribute bits 0-2
Jamie Magee [Sat, 2 May 2026 05:00:43 +0000 (22:00 -0700)] 
libfdisk: gpt: accept numeric attribute bits 0-2

gpt_entry_attrs_from_string() applied the GUID-specific range check
(48-63) to every numeric input. As a result, bare numeric bits 0, 1
and 2 were silently rejected. Those bits are RequiredPartition,
NoBlockIOProtocol and LegacyBIOSBootable, so the only way to set
them was by name.

That trips up any tool that emits attributes as a numeric list.
systemd-repart, for instance, formats Flags= as a comma-separated
list of decimal bit numbers, so Flags=0x4 (LegacyBIOSBootable) was
silently lost.

Split the numeric validation by source token:

  - bare <bit> accepts {0,1,2} or [48,63];
  - GUID:<bit> stays at [48,63]; the GUID: prefix belongs to the
    GUID-specific range only;
  - bits 3-47 are still rejected (UEFI-reserved).

Two drive-by fixes in the same block:

  - 'end == str' compared strtol's end pointer to the function's
    input rather than the current parse position; replace with
    'end == p'.
  - The diagnostic for an unsupported numeric bit printed p after
    the GUID: strip, so "GUID:5" came out as "5". Save the token
    start and pass that to fdisk_warnx().

Tests cover the new accepted forms (bare 0-2, mixed "<n>,GUID:<m>",
hex) and the still-rejected reserved range.

Fixes: https://github.com/util-linux/util-linux/issues/3353
Reference: https://github.com/systemd/systemd/issues/35591
Signed-off-by: Jamie Magee <jamie.magee@gmail.com>
2 months agolib: (fileutils) new fopen_at_no_link routine
Christian Goeschel Ndjomouo [Mon, 27 Apr 2026 00:50:53 +0000 (20:50 -0400)] 
lib: (fileutils) new fopen_at_no_link routine

This function wraps around openat(2), fstat(2), ftruncate(2) and
fdopen(3) to create a file stream that is not a symbolic or hard
link in a race-free manner. It achieves this by implictly setting
the O_NOFOLLOW bit to openat(2) opening flags and later checks if
any hardlinks are registered for the file pointing to the acquired
file descriptor.

If all checks pass a pointer to the file stream handler is returned.

The relevance for this function becomes apparent in script(2) where
the default logfile is not allowed to be a link unless the --force
option is passed and where the current method is vulnerable to a
TOCTOU attack. It also helps with the code clarity as it moves the
complexity of opening link free file streams to an internal helper
and prevents scope creep as well as keeping the code base focused
on its most relevant concern, which is recording the input/output.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 months agoMerge branch 'fallocate_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Thu, 30 Apr 2026 08:24:50 +0000 (10:24 +0200)] 
Merge branch 'fallocate_tests' of https://github.com/cgoesche/util-linux-fork

* 'fallocate_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: (fallocate) test the --collapse-range option

2 months agoMerge branch 'column_heap_corruption' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Thu, 30 Apr 2026 07:48:55 +0000 (09:48 +0200)] 
Merge branch 'column_heap_corruption' of https://github.com/cgoesche/util-linux-fork

* 'column_heap_corruption' of https://github.com/cgoesche/util-linux-fork:
  column: fix missing out-of-bounds check in table reordering

2 months agoMerge branch 'chsh_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Thu, 30 Apr 2026 07:47:47 +0000 (09:47 +0200)] 
Merge branch 'chsh_tests' of https://github.com/cgoesche/util-linux-fork

* 'chsh_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: regression tests for chsh(1)

3 months agotests: (fallocate) test the --collapse-range option
Christian Goeschel Ndjomouo [Fri, 24 Apr 2026 00:19:55 +0000 (20:19 -0400)] 
tests: (fallocate) test the --collapse-range option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agocolumn: fix missing out-of-bounds check in table reordering
Christian Goeschel Ndjomouo [Sat, 25 Apr 2026 21:01:06 +0000 (17:01 -0400)] 
column: fix missing out-of-bounds check in table reordering

When the --table-order option is used we allocate memory on
the heap for the actual amount of columns we receive from
the input, and later store the wanted column struct objects,
specified in the --table-order list, in that memory space.

We do this by iterating over the order list and incrementing
the heap pointer with a counter variable. This leads to a
buffer overflow when the amount of input columns is smaller
than the amount of columns specified in the table order list.

To prevent this we iterate over the order list for as long as
the counter is smaller than the number of input columns.

Closes: #4281
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotests: regression tests for chsh(1)
Christian Goeschel Ndjomouo [Mon, 20 Apr 2026 21:44:30 +0000 (17:44 -0400)] 
tests: regression tests for chsh(1)

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agoMerge branch 'libsmartcols/filter-fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 29 Apr 2026 10:13:19 +0000 (12:13 +0200)] 
Merge branch 'libsmartcols/filter-fixes' of https://github.com/t-8ch/util-linux

* 'libsmartcols/filter-fixes' of https://github.com/t-8ch/util-linux:
  libsmartcols: (tests) fix failure reporting in filter test
  libsmartcols: drop superfluous call yo yylex_init()
  libsmartcols: (tests) fix filter test name

3 months agoMerge branch 'PR/lsmem-cleanup' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 29 Apr 2026 10:10:28 +0000 (12:10 +0200)] 
Merge branch 'PR/lsmem-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/lsmem-cleanup' of https://github.com/karelzak/util-linux-work:
  lsmem: sort longopts[] alphabetically
  lsmem: improve usage() output
  lsmem: use bool for struct lsmem members

3 months agoMerge branch 'PR/cfdisk-cleanup' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 29 Apr 2026 10:09:53 +0000 (12:09 +0200)] 
Merge branch 'PR/cfdisk-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/cfdisk-cleanup' of https://github.com/karelzak/util-linux-work:
  cfdisk: remove unnecessary cursor repositioning on exit
  cfdisk: fix memory leak of original_layout table

3 months agoMerge branch 'PR/last-phantom-detection' of https://github.com/karelzak/util-linux...
Karel Zak [Wed, 29 Apr 2026 10:09:41 +0000 (12:09 +0200)] 
Merge branch 'PR/last-phantom-detection' of https://github.com/karelzak/util-linux-work

* 'PR/last-phantom-detection' of https://github.com/karelzak/util-linux-work:
  last: fix phantom detection for unset loginuid and X11 sessions

3 months agoMerge branch 'feat/4288' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 29 Apr 2026 10:06:27 +0000 (12:06 +0200)] 
Merge branch 'feat/4288' of https://github.com/echoechoin/util-linux

* 'feat/4288' of https://github.com/echoechoin/util-linux:
  bash-completion: add --expand option for bits
  bits: add tests for --expand option
  bits: add --expand option to output individual bit IDs

3 months agoMerge branch 'fix_issue/4272' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 29 Apr 2026 09:28:45 +0000 (11:28 +0200)] 
Merge branch 'fix_issue/4272' of https://github.com/echoechoin/util-linux

* 'fix_issue/4272' of https://github.com/echoechoin/util-linux:
  test_sigreceive: use ul_getuserpw_str() for user name/UID parsing
  renice: use proper types and strutils for ID parsing

3 months agoMerge branch 'feat/3887/rename' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 29 Apr 2026 08:07:20 +0000 (10:07 +0200)] 
Merge branch 'feat/3887/rename' of https://github.com/echoechoin/util-linux

* 'feat/3887/rename' of https://github.com/echoechoin/util-linux:
  rename: fix buffer overflow by using PATH_MAX instead of unreliable st_size
  rename: add --copy option to copy instead of rename

3 months agotest_sigreceive: use ul_getuserpw_str() for user name/UID parsing
WanBingjiang [Wed, 29 Apr 2026 07:01:23 +0000 (15:01 +0800)] 
test_sigreceive: use ul_getuserpw_str() for user name/UID parsing

3 months agorenice: use proper types and strutils for ID parsing
WanBingjiang [Thu, 23 Apr 2026 09:49:07 +0000 (17:49 +0800)] 
renice: use proper types and strutils for ID parsing

Use ul_strtou32() instead of strtol() to parse PID/UID/GID and reject
negative values. Use strtos32_or_err() for priority. Change 'who' type
to uid_t and adjust getprio()/donice(). Use %u for unsigned IDs.

Addresses: https://github.com/util-linux/util-linux/issues/4272
Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agobash-completion: add --expand option for bits
WanBingjiang [Mon, 27 Apr 2026 09:12:11 +0000 (17:12 +0800)] 
bash-completion: add --expand option for bits

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agobits: add tests for --expand option
WanBingjiang [Mon, 27 Apr 2026 06:59:50 +0000 (14:59 +0800)] 
bits: add tests for --expand option

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agobits: add --expand option to output individual bit IDs
WanBingjiang [Mon, 27 Apr 2026 06:51:25 +0000 (14:51 +0800)] 
bits: add --expand option to output individual bit IDs

Add -e/--expand output mode that prints each set bit as a
comma-separated list without range compression. This is useful
for scripting when individual IDs are needed (e.g., CPU ID iteration).

Example: bits --expand 1,3-5,7 → 1,3,4,5,7
Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agolibsmartcols: (tests) fix failure reporting in filter test
Thomas Weißschuh [Tue, 28 Apr 2026 17:38:46 +0000 (19:38 +0200)] 
libsmartcols: (tests) fix failure reporting in filter test

The pipeline executes the calls to ts_init_subtest and
ts_finalize_subtest in a subshell. This breaks their functionality
and test failures are not reported properly.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibsmartcols: drop superfluous call yo yylex_init()
Thomas Weißschuh [Tue, 28 Apr 2026 22:08:09 +0000 (00:08 +0200)] 
libsmartcols: drop superfluous call yo yylex_init()

The lexer is already initialized with yylex_init_extra(),
making the call to yylex_init() superfluous.
Furthermore this is leaking memory.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibsmartcols: (tests) fix filter test name
Thomas Weißschuh [Tue, 28 Apr 2026 17:38:08 +0000 (19:38 +0200)] 
libsmartcols: (tests) fix filter test name

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolsmem: sort longopts[] alphabetically
Karel Zak [Tue, 28 Apr 2026 13:36:13 +0000 (15:36 +0200)] 
lsmem: sort longopts[] alphabetically

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolsmem: improve usage() output
Karel Zak [Tue, 28 Apr 2026 13:35:37 +0000 (15:35 +0200)] 
lsmem: improve usage() output

Sort options alphabetically and use [=<when>] consistently for
--summary (matching --annotate and other tools).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolsmem: use bool for struct lsmem members
Karel Zak [Tue, 28 Apr 2026 13:31:31 +0000 (15:31 +0200)] 
lsmem: use bool for struct lsmem members

Replace bit fields with bool and remove unused 'summary' member.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'lsmem_annotate_opt' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 28 Apr 2026 13:23:28 +0000 (15:23 +0200)] 
Merge branch 'lsmem_annotate_opt' of https://github.com/cgoesche/util-linux-fork

* 'lsmem_annotate_opt' of https://github.com/cgoesche/util-linux-fork:
  lsmem: add column header annotations

3 months agocfdisk: remove unnecessary cursor repositioning on exit
Karel Zak [Tue, 28 Apr 2026 13:04:09 +0000 (15:04 +0200)] 
cfdisk: remove unnecessary cursor repositioning on exit

Remove the mvcur() call that moved the cursor to the bottom of the
terminal before endwin(). This pattern was inherited from the original
cfdisk (util-linux 2.2, 1996) and is unnecessary on modern terminals
where endwin() properly restores the terminal state.

The old behavior created extra blank lines between the previous shell
prompt and the new one after exiting cfdisk.

Addresses: https://github.com/util-linux/util-linux/discussions/4259
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agocfdisk: fix memory leak of original_layout table
Karel Zak [Tue, 28 Apr 2026 12:51:14 +0000 (14:51 +0200)] 
cfdisk: fix memory leak of original_layout table

The original_layout table, allocated via fdisk_get_partitions() to
track the on-disk partition layout, was never freed on exit. Add the
missing fdisk_unref_table() call.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/autotools-pkg-config-libs' of https://github.com/karelzak/util-linux...
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

3 months agoMerge branch 'cross-platform' of https://github.com/t-8ch/util-linux
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

3 months agolast: fix phantom detection for unset loginuid and X11 sessions
Karel Zak [Tue, 28 Apr 2026 11:55:45 +0000 (13:55 +0200)] 
last: fix phantom detection for unset loginuid and X11 sessions

Don't mark a session as phantom when /proc/pid/loginuid exists but
has not been set by pam_loginuid.so (contains the kernel's unset
sentinel value 4294967295).

Skip the /dev/ tty stat() check when the utline starts with ':'
(traditional X11 session registration by xdm/sessreg).

Based on a patch by glangshaw.

Fixes: https://github.com/util-linux/util-linux/issues/4295
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'dmesg_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 28 Apr 2026 11:35:48 +0000 (13:35 +0200)] 
Merge branch 'dmesg_tests' of https://github.com/cgoesche/util-linux-fork

* 'dmesg_tests' of https://github.com/cgoesche/util-linux-fork:
  tests: (dmesg) use more long-opts to better track coverage

3 months agoMerge branch 'fix_issue/4271' of https://github.com/echoechoin/util-linux
Karel Zak [Tue, 28 Apr 2026 11:17:58 +0000 (13:17 +0200)] 
Merge branch 'fix_issue/4271' of https://github.com/echoechoin/util-linux

* 'fix_issue/4271' of https://github.com/echoechoin/util-linux:
  dmesg: fix out-of-bounds read when parsing malformed kmsg file

3 months agoautotools: fix AM_CONDITIONAL for HAVE_UDEV and HAVE_AUDIT
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.

3 months agoautotools,meson: drop unnecessary libm from test_pty
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: split MATH_LIBS and ISNAN_LIBS
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use PKG_CHECK_MODULES for zlib
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use PKG_CHECK_MODULES for libcap-ng
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use PKG_CHECK_MODULES for libaudit
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use PKG_CHECK_MODULES for libudev
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use $(MATH_LIBS) instead of -lm for hwclock
Karel Zak [Thu, 16 Apr 2026 13:15:20 +0000 (15:15 +0200)] 
autotools: use $(MATH_LIBS) instead of -lm for hwclock

Use the variable set by AC_CHECK_LIB in configure.ac rather than
hardcoding -lm, consistent with how other utilities use $(MATH_LIBS).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use $(SQLITE3_LIBS) instead of -lsqlite3
Karel Zak [Thu, 16 Apr 2026 13:11:25 +0000 (15:11 +0200)] 
autotools: use $(SQLITE3_LIBS) instead of -lsqlite3

Use the pkg-config variable set by PKG_CHECK_MODULES in configure.ac
rather than hardcoding -lsqlite3.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use $(SELINUX_LIBS) instead of -lselinux
Karel Zak [Thu, 16 Apr 2026 13:11:05 +0000 (15:11 +0200)] 
autotools: use $(SELINUX_LIBS) instead of -lselinux

Use the pkg-config variable set by PKG_CHECK_MODULES in configure.ac
rather than hardcoding -lselinux.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoautotools: use $(ECONF_LIBS) instead of -leconf
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/ci-fix-po4a-build' of https://github.com/karelzak/util-linux-work
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

3 months agoMerge branch 'fix/4287' of https://github.com/echoechoin/util-linux
Karel Zak [Tue, 28 Apr 2026 09:12:52 +0000 (11:12 +0200)] 
Merge branch 'fix/4287' of https://github.com/echoechoin/util-linux

* 'fix/4287' of https://github.com/echoechoin/util-linux:
  bits: use getline() to avoid stdin input truncation

3 months agoMerge branch 'macos-prep' of https://github.com/t-8ch/util-linux
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

3 months agotreewide: avoid unused argument and missing return warnings in fallbacks
Thomas Weißschuh [Sun, 12 Apr 2026 06:07:40 +0000 (08:07 +0200)] 
treewide: avoid unused argument and missing return warnings in fallbacks

Make sure that the callback codepaths do not generate warnings about
unused arguments and missing returns.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agohardlink: (tests) Ignore xattrs
Thomas Weißschuh [Sun, 12 Apr 2026 06:11:20 +0000 (08:11 +0200)] 
hardlink: (tests) Ignore xattrs

If the code is built without xattr support, those won't be printed
and the tests fails.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agosetpgid: (tests) validate presence of /proc/self/stat
Thomas Weißschuh [Sun, 12 Apr 2026 06:12:38 +0000 (08:12 +0200)] 
setpgid: (tests) validate presence of /proc/self/stat

The tests use /proc/self/stat and fail if that is not available.
Handle its absence gracefully.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agotests: show kernel type
Thomas Weißschuh [Sun, 12 Apr 2026 06:12:15 +0000 (08:12 +0200)] 
tests: show kernel type

In addition to the kernel version it is useful to know the kernel type.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibsmartcols: Ignore -Wsign-compare in filter-scanner.l
Thomas Weißschuh [Sun, 12 Apr 2026 06:08:46 +0000 (08:08 +0200)] 
libsmartcols: Ignore -Wsign-compare in filter-scanner.l

The code generated from filter-scanner.l generates a sign comparision
warning on macOS.

There is nothing we can do about that, so ignore the warning similar to
other generated code.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoflock: (test) Only test fcntl vs flock on Linux
Thomas Weißschuh [Sun, 12 Apr 2026 06:12:29 +0000 (08:12 +0200)] 
flock: (test) Only test fcntl vs flock on Linux

On other operating systems fcntl and flock may not actually be
independent, failing the test. This happens for example on macOS.

Only run this subtest on Linux.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agomeson: (libfdisk, libsmartcols, libmount) handle linkers without version script support
Thomas Weißschuh [Sun, 12 Apr 2026 06:03:43 +0000 (08:03 +0200)] 
meson: (libfdisk, libsmartcols, libmount) handle linkers without version script support

The linker may not support version scripts. Handle this for libfdisk,
libsmartcols and libmount the same way as libuuid and libblkid.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agohardlink: handle ENOTDIR from nftw() on a file
Thomas Weißschuh [Sun, 12 Apr 2026 06:09:32 +0000 (08:09 +0200)] 
hardlink: handle ENOTDIR from nftw() on a file

POSIX allows nftw() to return ENOTDIR if the path argument does not
point to a directory. This happens for example on macOS.

Handle ENOTDIR by calling the existing handler manually on the single
file.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoMerge branch 'unshare_whitelist_env_option' of https://github.com/cgoesche/util-linux...
Karel Zak [Tue, 28 Apr 2026 08:12:45 +0000 (10:12 +0200)] 
Merge branch 'unshare_whitelist_env_option' of https://github.com/cgoesche/util-linux-fork

* 'unshare_whitelist_env_option' of https://github.com/cgoesche/util-linux-fork:
  unshare: add whitelist-env command line option

3 months agoMerge branch 'fix_kernel_version_check' of https://github.com/cgoesche/util-linux...
Karel Zak [Tue, 28 Apr 2026 08:06:23 +0000 (10:06 +0200)] 
Merge branch 'fix_kernel_version_check' of https://github.com/cgoesche/util-linux-fork

* 'fix_kernel_version_check' of https://github.com/cgoesche/util-linux-fork:
  tests/functions.sh: consider '+' for metadata in kernel version parsing

3 months agoMerge branch 'runuser_regression' of https://github.com/cgoesche/util-linux-fork
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

3 months agoci: install libunicode-linebreak-perl for po4a translations
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.

3 months agoci: fix CodeQL build failure due to missing po4a dependency
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.

3 months agoMerge branch 'manpage-fix' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 28 Apr 2026 07:48:54 +0000 (09:48 +0200)] 
Merge branch 'manpage-fix' of https://github.com/t-8ch/util-linux

* 'manpage-fix' of https://github.com/t-8ch/util-linux:
  lastlog2: (man) fix example syntax

3 months agorename: fix buffer overflow by using PATH_MAX instead of unreliable st_size
WanBingjiang [Tue, 28 Apr 2026 07:32:55 +0000 (15:32 +0800)] 
rename: fix buffer overflow by using PATH_MAX instead of unreliable st_size

/proc and virtual filesystems return st_size = 0, leading to invalid buffers

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agorename: add --copy option to copy instead of rename
WanBingjiang [Fri, 27 Feb 2026 09:08:39 +0000 (17:08 +0800)] 
rename: add --copy option to copy instead of rename

Regular files: copy content with ul_copy_file(), preserve permissions.
Symlinks: create new link with same target. Add tests and man page.

Addresses: util-linux#3887

3 months agodmesg: fix out-of-bounds read when parsing malformed kmsg file
WanBingjiang [Thu, 23 Apr 2026 10:48:06 +0000 (18:48 +0800)] 
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.

Addresses: https://github.com/util-linux/util-linux/issues/4271
Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agolsmem: add column header annotations
Christian Goeschel Ndjomouo [Mon, 23 Mar 2026 02:56:56 +0000 (22:56 -0400)] 
lsmem: add column header annotations

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotests: (dmesg) use more long-opts to better track coverage
Christian Goeschel Ndjomouo [Thu, 23 Apr 2026 18:29:32 +0000 (14:29 -0400)] 
tests: (dmesg) use more long-opts to better track coverage

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agounshare: add whitelist-env command line option
Christian Goeschel Ndjomouo [Mon, 20 Apr 2026 04:16:11 +0000 (00:16 -0400)] 
unshare: add whitelist-env command line option

This new option allows controlled inheritance of environment
variables from the parent process by the unshared process.

This option by default clears all environment variables except
for those provided in the option argument, specified as a
comma-separated list.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agolastlog2: (man) fix example syntax
Thomas Weißschuh [Mon, 27 Apr 2026 13:24:47 +0000 (15:24 +0200)] 
lastlog2: (man) fix example syntax

The examples are not using the right syntax for literal blocks,
leading to errors from asciidoctor.

Use the correct syntax.

Fixes: cd112d860bf6 ("lastlog2: add --journal option to manage SQLite journal mode")
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agosu-common: revert "su: pass arguments after <user> to shell"
Christian Goeschel Ndjomouo [Tue, 7 Apr 2026 14:25:17 +0000 (10:25 -0400)] 
su-common: revert "su: pass arguments after <user> to shell"

This reverts commit ac0147fd14b348097c82c1c89a5417b582e26bad.

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>
3 months agotests: add regression tests for runuser
Christian Goeschel Ndjomouo [Fri, 3 Apr 2026 16:06:59 +0000 (12:06 -0400)] 
tests: add regression tests for runuser

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agoMerge branch 'mkfs_cramfs_args' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 27 Apr 2026 11:38:38 +0000 (13:38 +0200)] 
Merge branch 'mkfs_cramfs_args' of https://github.com/stoeckmann/util-linux

* 'mkfs_cramfs_args' of https://github.com/stoeckmann/util-linux:
  mkfs.cramfs: Consider -i only once
  mkfs.cramfs: Add -p padding only once

3 months agoMerge branch 'ci/openwrt-25.12' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 27 Apr 2026 11:31:15 +0000 (13:31 +0200)] 
Merge branch 'ci/openwrt-25.12' of https://github.com/t-8ch/util-linux

* 'ci/openwrt-25.12' of https://github.com/t-8ch/util-linux:
  ci: update to latest OpenWrt release

3 months agoMerge branch 'PR/agetty-credentials' of https://github.com/karelzak/util-linux-work
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

3 months agopo-man: add ll2_get_journal_mode and ll2_set_journal_mode to po4a.cfg
Karel Zak [Mon, 27 Apr 2026 11:05:35 +0000 (13:05 +0200)] 
po-man: add ll2_get_journal_mode and ll2_set_journal_mode to po4a.cfg

3 months agotools/git-tp-sync: update po4a.cfg language list on sync
Karel Zak [Mon, 27 Apr 2026 10:48:23 +0000 (12:48 +0200)] 
tools/git-tp-sync: update po4a.cfg language list on sync

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'patch-27' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 27 Apr 2026 10:42:56 +0000 (12:42 +0200)] 
Merge branch 'patch-27' of https://github.com/mariobl/util-linux

* 'patch-27' of https://github.com/mariobl/util-linux:
  [po-man] Add missing languages to po4a.cfg

3 months agoMerge branch 'manpages_term_consistency' of https://github.com/cgoesche/util-linux...
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'

3 months agolsblk: update source file comments after rename
Karel Zak [Mon, 27 Apr 2026 09:41:56 +0000 (11:41 +0200)] 
lsblk: update source file comments after rename

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'close/issue_4146' of https://github.com/lord2y/util-linux
Karel Zak [Mon, 27 Apr 2026 09:39:52 +0000 (11:39 +0200)] 
Merge branch 'close/issue_4146' of https://github.com/lord2y/util-linux

* 'close/issue_4146' of https://github.com/lord2y/util-linux:
  lsblk: move source files to dedicated lsblk-cmd/ directory

3 months agobash-completion: (lastlog2) quote $cur in --journal completion
Karel Zak [Mon, 27 Apr 2026 09:37:53 +0000 (11:37 +0200)] 
bash-completion: (lastlog2) quote $cur in --journal completion

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'fix/4157' of https://github.com/echoechoin/util-linux
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

3 months agoMerge branch 'lsblk_annotate_opt' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 27 Apr 2026 09:28:18 +0000 (11:28 +0200)] 
Merge branch 'lsblk_annotate_opt' of https://github.com/cgoesche/util-linux-fork

* 'lsblk_annotate_opt' of https://github.com/cgoesche/util-linux-fork:
  lsblk: add column header annotations

3 months agoMerge branch 'pager-enable-lslocks' of https://github.com/kurok/util-linux
Karel Zak [Mon, 27 Apr 2026 09:25:03 +0000 (11:25 +0200)] 
Merge branch 'pager-enable-lslocks' of https://github.com/kurok/util-linux

* 'pager-enable-lslocks' of https://github.com/kurok/util-linux:
  lslocks: add --pager and --nopager options

3 months agocopyfilerange: use err() instead of errx() with glibc %m
Karel Zak [Mon, 27 Apr 2026 08:32:06 +0000 (10:32 +0200)] 
copyfilerange: use err() instead of errx() with glibc %m

Replace errx() + %m format specifier with err(), which portably
appends strerror(errno) without relying on the glibc-specific %m
extension.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'warnerr_newline' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 27 Apr 2026 08:31:20 +0000 (10:31 +0200)] 
Merge branch 'warnerr_newline' of https://github.com/stoeckmann/util-linux

* 'warnerr_newline' of https://github.com/stoeckmann/util-linux:
  Fix error message handling in sample/test code
  wdctl: Remove newline from warning message
  eject: Remove newline from warning messages
  copyfilerange: Remove newline from error messages
  sulogin: Remove newline from error messages
  mkfs.minix: Remove newline from error message

3 months agoMerge branch 'bash' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 27 Apr 2026 08:21:05 +0000 (10:21 +0200)] 
Merge branch 'bash' of https://github.com/t-8ch/util-linux

* 'bash' of https://github.com/t-8ch/util-linux:
  treewide: use bash from PATH

3 months agoMerge branch 'PR/libblkid-fix-overflows' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 27 Apr 2026 08:17:54 +0000 (10:17 +0200)] 
Merge branch 'PR/libblkid-fix-overflows' of https://github.com/karelzak/util-linux-work

* 'PR/libblkid-fix-overflows' of https://github.com/karelzak/util-linux-work:
  libblkid: reiserfs: add block size validation for reiser4
  libblkid: erofs: validate blkszbits before checksum calculation
  libblkid: exfs: avoid 32-bit overflow in rextsize validation
  libblkid: solaris: use 64-bit for partition offset calculations
  libblkid: bsd: use 64-bit for partition offset calculations
  libblkid: mac: use 64-bit for partition offset calculations
  libblkid: dos: use 64-bit for partition offset calculations
  libblkid: udf: avoid 32-bit overflow in offset calculations
  libblkid: vfat: avoid 32-bit overflow in offset calculations
  libblkid: ubi: fix probe return values
  libblkid: f2fs: tighten log_blocksize validation
  libblkid: nilfs: fix byte order and block size validation
  libblkid: gpt: fix wiper offset to use sector size
  libblkid: udf: cap descriptor sequence iteration count
  libblkid: bcache: add missing NULL check
  libblkid: bsd: read enough data to cover disklabel struct
  libblkid: befs: improve bounds checking in B+ tree search
  libblkid: ntfs: improve integer overflow checks

3 months agocopyfilerange: (man) fix swapped offsets in command example
Štěpán Němec [Wed, 22 Apr 2026 18:25:03 +0000 (20:25 +0200)] 
copyfilerange: (man) fix swapped offsets in command example

Signed-off-by: Štěpán Němec <stepnem@smrk.net>
3 months agobits: use getline() to avoid stdin input truncation
WanBingjiang [Mon, 27 Apr 2026 06:25:54 +0000 (14:25 +0800)] 
bits: use getline() to avoid stdin input truncation

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agolsblk: move source files to dedicated lsblk-cmd/ directory
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.

Closes: https://github.com/util-linux/util-linux/issues/4146
Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
3 months agoliblastlog2: declare variables at the top of the block
WanBingjiang [Fri, 24 Apr 2026 09:01:44 +0000 (17:01 +0800)] 
liblastlog2: declare variables at the top of the block

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agoliblastlog2: register journal mode man pages in build system
WanBingjiang [Fri, 24 Apr 2026 08:53:28 +0000 (16:53 +0800)] 
liblastlog2: register journal mode man pages in build system

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
3 months agolastlog2: add --journal option to manage SQLite journal mode
WanBingjiang [Wed, 22 Apr 2026 05:46:56 +0000 (13:46 +0800)] 
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.

Addresses: https://github.com/util-linux/util-linux/issues/4157
Addresses: https://github.com/util-linux/util-linux/issues/4261
Assisted-by: Claude:claude-sonnet-4.5
Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>