]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 months agolsfd: (refactor) call ioctl(TUNGETDEVNETNS) from target_fd related methods
Masatake YAMATO [Wed, 4 Feb 2026 20:42:16 +0000 (05:42 +0900)] 
lsfd: (refactor) call ioctl(TUNGETDEVNETNS) from target_fd related methods

In the original code, the attach_xinfo method of the cdev_tun_ops
struct called the ioctl. The attach_xinfo method retrieved the fd
passing to the ioctl by calling call_with_foreign_fd utility function.

In the last commit, we added the target_fd related methods in
cdev_tun_ops struct. The caller side of the target_fd related methods
calls call_with_foreign_fd.

We can reduce the code calling call_with_foreign_fd by moving the code
calling ioctl from the attach_xinfo method to the target_fd related
methods.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: add stubs of target_fd related methods to cdev_class
Masatake YAMATO [Wed, 4 Feb 2026 20:22:09 +0000 (05:22 +0900)] 
lsfd: add stubs of target_fd related methods to cdev_class

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: (lsfd::*) revise the way to use "$?"
Masatake YAMATO [Tue, 24 Feb 2026 17:58:02 +0000 (02:58 +0900)] 
tests: (lsfd::*) revise the way to use "$?"

* Don't use $? for printing the result of if-conditions; use
  literals instead (0 or 1).

* Don' use $? for referring to the result of wait built-in; store the
  result to $RC just after the wait built-in invocation.

* Use ${PIPESTATUS[]} instead of $?.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: (lsns::*) revise the way to use "$?"
Masatake YAMATO [Tue, 24 Feb 2026 18:16:40 +0000 (03:16 +0900)] 
tests: (lsns::*) revise the way to use "$?"

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoman pages: consolidate libsmartcols environment variables
Karel Zak [Tue, 24 Feb 2026 08:54:12 +0000 (09:54 +0100)] 
man pages: consolidate libsmartcols environment variables

Introduce man-common/env-smartcols.adoc to describe all libsmartcols
environment variables (LIBSMARTCOLS_DEBUG, LIBSMARTCOLS_DEBUG_PADDING,
LIBSMARTCOLS_JSON) in one place.

Replace duplicated LIBSMARTCOLS_DEBUG descriptions in cfdisk, fdisk,
sfdisk, findmnt, lsblk, and column man pages with an include of the
new common file.

Addresses: https://github.com/util-linux/util-linux/issues/3971
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolibblkid: iso9660: validate root directory to reduce false positives
Karel Zak [Tue, 24 Feb 2026 11:41:39 +0000 (12:41 +0100)] 
libblkid: iso9660: validate root directory to reduce false positives

The CD001 magic signature at 32KB offset can match file data content
on other filesystems (e.g. an .iso file stored on XFS whose data
blocks happen to land at the device offset where blkid looks for the
ISO 9660 Primary Volume Descriptor). This causes blkid to report
ambivalent results for a device that has only one real filesystem.

Add validation of the root directory record from the PVD: read the
root directory extent and verify that the first entry is a valid "."
self-reference (file_id_len == 1, file_id == 0x00, extent location
pointing back to itself). This check reliably rejects false positive
CD001 signatures because the root directory LBA from the PVD points
to a different location on the device that contains unrelated data.

Addresses: https://github.com/util-linux/util-linux/issues/4031
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'pager_async_sig' of https://github.com/stoeckmann/util-linux
Karel Zak [Tue, 24 Feb 2026 09:11:02 +0000 (10:11 +0100)] 
Merge branch 'pager_async_sig' of https://github.com/stoeckmann/util-linux

* 'pager_async_sig' of https://github.com/stoeckmann/util-linux:
  lib/pager: Remove unused code
  lib/pager: Use async-signal safe signal handler

4 months agojsonwrt: rename ul_json_format_t to enum ul_json_format
Karel Zak [Tue, 24 Feb 2026 09:06:16 +0000 (10:06 +0100)] 
jsonwrt: rename ul_json_format_t to enum ul_json_format

The _t suffix is reserved by POSIX. Use a plain enum tag instead.

Addresses: https://github.com/util-linux/util-linux/pull/4025
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'feat/3971_compact_json_and_jsonl_support' of https://github.com/echoech...
Karel Zak [Tue, 24 Feb 2026 08:38:09 +0000 (09:38 +0100)] 
Merge branch 'feat/3971_compact_json_and_jsonl_support' of https://github.com/echoechoin/util-linux

* 'feat/3971_compact_json_and_jsonl_support' of https://github.com/echoechoin/util-linux:
  jsonwrt: simplify ul_jsonwrt_empty() and add comments for COMPACT format
  column: using switch-case replaces if-else
  column: add JSON compact format output subtest.
  column: add JSON LINES format output subtest.
  column: introduce LIBSMARTCOLS_JSON environment argument
  jsonwrt: support Compact JSON format output
  libsmartcols: support JSON Lines format output

4 months agoMerge branch 'pager_error' of https://github.com/stoeckmann/util-linux
Karel Zak [Tue, 24 Feb 2026 08:29:30 +0000 (09:29 +0100)] 
Merge branch 'pager_error' of https://github.com/stoeckmann/util-linux

* 'pager_error' of https://github.com/stoeckmann/util-linux:
  lib/pager: Handle dup errors

4 months agoMerge branch 'libblkid_fix_cache_garbage_collection' of https://github.com/cgoesche...
Karel Zak [Tue, 24 Feb 2026 08:13:15 +0000 (09:13 +0100)] 
Merge branch 'libblkid_fix_cache_garbage_collection' of https://github.com/cgoesche/util-linux-fork

* 'libblkid_fix_cache_garbage_collection' of https://github.com/cgoesche/util-linux-fork:
  blkid: add --garbage-collect test
  libblkid: remove empty loop devices from cache when garbage collecting

4 months agoblkzone: add more checks when printing zone write_pointer
Wilfred Mallawa [Mon, 23 Feb 2026 23:43:29 +0000 (09:43 +1000)] 
blkzone: add more checks when printing zone write_pointer

The zone write pointer is also invalid for READONLY and OFFLINE zones, so
handle such cases appropriately by not displaying a write pointer for
READONLY and OFFLINE zones.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Fixes: b032247f48 ("blkzone: don't show wptr when zones are full")
4 months agolib/pager: Remove unused code
Tobias Stoeckmann [Mon, 23 Feb 2026 19:01:50 +0000 (20:01 +0100)] 
lib/pager: Remove unused code

The pager_process.pid check already happens before wait_for_pager is
called now.

Also, errno is not used anymore after the signal handler, so no need to
save it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 months agolib/pager: Use async-signal safe signal handler
Tobias Stoeckmann [Mon, 23 Feb 2026 18:51:25 +0000 (19:51 +0100)] 
lib/pager: Use async-signal safe signal handler

Accessing pager_process.pid from within a signal handler is, by strict C
language interpretation, not signal safe.

Wait for all children (and thus for pager_process.pid as well) instead.
The current users dmesg and fdisk have no further children so this is a
good compromise here.

The signal handler is used for SIGINT, SIGHUP, SIGTERM, SIGQUIT. From a
terminal perspective, these are normally intercepted by the child, not
the parent.

Since wait_for_pager is never reached by a signal handler anymore, a
regular err() call is now possible. Just make sure that no exit function
handler could ever loop endlessly.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 months agolib/pager: Handle dup errors
Tobias Stoeckmann [Mon, 23 Feb 2026 18:57:34 +0000 (19:57 +0100)] 
lib/pager: Handle dup errors

If dup fails, e.g. due to open file descriptor limitations, gracefully
handle the situation and do not start the pager.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
4 months agoumount: add test for --graceful option
Christian Goeschel Ndjomouo [Fri, 20 Feb 2026 23:26:11 +0000 (18:26 -0500)] 
umount: add test for --graceful option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 months agoumount: new --graceful option to exit successfully even if filesystem is unmounted
Christian Goeschel Ndjomouo [Fri, 20 Feb 2026 23:01:29 +0000 (18:01 -0500)] 
umount: new --graceful option to exit successfully even if filesystem is unmounted

This new option makes it so that umount(8) exits successfully even
if the filesystem has already been unmounted or has no directory
entry. The usefulness of this behavior becomes apparent in cases
where idempotency is important, that is the focus lies in the
destruction of the mountpoint only.

Closes: #2132
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 months agoMerge branch 'dmesg_sigpipe' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Feb 2026 13:20:13 +0000 (14:20 +0100)] 
Merge branch 'dmesg_sigpipe' of https://github.com/stoeckmann/util-linux

* 'dmesg_sigpipe' of https://github.com/stoeckmann/util-linux:
  lib/pager: Gracefully handle SIGPIPE errors
  dmesg: Gracefully handle EPIPE errors
  dmesg: Register pager_close as exit handler

4 months agoblkid: add --garbage-collect test
Christian Goeschel Ndjomouo [Sun, 22 Feb 2026 01:21:05 +0000 (20:21 -0500)] 
blkid: add --garbage-collect test

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 months agoMerge branch 'lsmem_show_zones_on_uncommon_phy_mem_layout' of https://github.com...
Karel Zak [Mon, 23 Feb 2026 13:06:57 +0000 (14:06 +0100)] 
Merge branch 'lsmem_show_zones_on_uncommon_phy_mem_layout' of https://github.com/cgoesche/util-linux-fork

* 'lsmem_show_zones_on_uncommon_phy_mem_layout' of https://github.com/cgoesche/util-linux-fork:
  lsmem: fix missing zone info when memory blocks start at an index other than 0

4 months agoMerge branch 'fileeq_typos' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Feb 2026 12:11:58 +0000 (13:11 +0100)] 
Merge branch 'fileeq_typos' of https://github.com/stoeckmann/util-linux

* 'fileeq_typos' of https://github.com/stoeckmann/util-linux:
  lib/fileeq: Fix typos

4 months agoMerge branch 'fileeq_debug' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Feb 2026 12:09:59 +0000 (13:09 +0100)] 
Merge branch 'fileeq_debug' of https://github.com/stoeckmann/util-linux

* 'fileeq_debug' of https://github.com/stoeckmann/util-linux:
  lib/fileeq: Extend debug message
  lib/fileeq: Fix formatters

4 months agoMerge branch 'hardlink_oob' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 23 Feb 2026 12:07:58 +0000 (13:07 +0100)] 
Merge branch 'hardlink_oob' of https://github.com/stoeckmann/util-linux

* 'hardlink_oob' of https://github.com/stoeckmann/util-linux:
  lib/fileeq: Prevent OOB with short read files

4 months agolibblkid: remove empty loop devices from cache when garbage collecting
Christian Goeschel Ndjomouo [Sat, 21 Feb 2026 03:42:02 +0000 (22:42 -0500)] 
libblkid: remove empty loop devices from cache when garbage collecting

The cache garbage collection (blkid --garbage-collect) does not work for
entries of loop devices even when these have been detached. The previous
logic performed a simple stat() on the dev node path, however this is not
enough for loop devices as their nodes can remain present even if they
aren't backed by any file or other block device.

Therefore, it is more sane to verify if the loop device has a backing file
and if not, we remove it from the cache.

Closes: #4061
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 months agoMerge branch 'blkdiscard_add_more_longopts_tests' of https://github.com/cgoesche...
Karel Zak [Mon, 23 Feb 2026 10:40:48 +0000 (11:40 +0100)] 
Merge branch 'blkdiscard_add_more_longopts_tests' of https://github.com/cgoesche/util-linux-fork

* 'blkdiscard_add_more_longopts_tests' of https://github.com/cgoesche/util-linux-fork:
  blkdiscard: (tests) add more long option tests

4 months agoMerge branch 'choom_add_tests' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 23 Feb 2026 10:06:51 +0000 (11:06 +0100)] 
Merge branch 'choom_add_tests' of https://github.com/cgoesche/util-linux-fork

* 'choom_add_tests' of https://github.com/cgoesche/util-linux-fork:
  choom: (testcoverage) add long options tests

4 months agoMerge branch 'blkid_add_more_long_opts_tests' of https://github.com/cgoesche/util...
Karel Zak [Mon, 23 Feb 2026 10:05:10 +0000 (11:05 +0100)] 
Merge branch 'blkid_add_more_long_opts_tests' of https://github.com/cgoesche/util-linux-fork

* 'blkid_add_more_long_opts_tests' of https://github.com/cgoesche/util-linux-fork:
  blkid: (testcoverage) add more long option tests

4 months agoMerge branch 'manpages-fix' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 23 Feb 2026 10:03:13 +0000 (11:03 +0100)] 
Merge branch 'manpages-fix' of https://github.com/mariobl/util-linux

* 'manpages-fix' of https://github.com/mariobl/util-linux:
  Fix formatting in getino.1.adoc

4 months agologin: improve comments for signal handling in fork_session()
Karel Zak [Mon, 23 Feb 2026 10:00:20 +0000 (11:00 +0100)] 
login: improve comments for signal handling in fork_session()

Add more detailed comments explaining the signal blocking and
sigsuspend() pattern introduced by the previous commit. The key
insight is that sigsuspend() is the actual wait point where
SIGTERM/SIGHUP are forwarded to the child, while waitpid() with
WNOHANG only performs non-blocking checks for terminated children.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agojsonwrt: simplify ul_jsonwrt_empty() and add comments for COMPACT format
WanBingjiang [Mon, 23 Feb 2026 08:32:48 +0000 (16:32 +0800)] 
jsonwrt: simplify ul_jsonwrt_empty() and add comments for COMPACT format

Consolidate duplicated LINE/COMPACT branches in ul_jsonwrt_empty()
into a single else-branch, since they produce identical output.

Add comments explaining the indent depth checks in ul_jsonwrt_open()
and ul_jsonwrt_close() for COMPACT format.

4 months agocolumn: using switch-case replaces if-else
WanBingjiang [Thu, 5 Feb 2026 10:02:47 +0000 (18:02 +0800)] 
column: using switch-case replaces if-else

4 months agocolumn: add JSON compact format output subtest.
WanBingjiang [Thu, 5 Feb 2026 09:30:12 +0000 (17:30 +0800)] 
column: add JSON compact format output subtest.

4 months agocolumn: add JSON LINES format output subtest.
WanBingjiang [Thu, 5 Feb 2026 09:13:44 +0000 (17:13 +0800)] 
column: add JSON LINES format output subtest.

4 months agocolumn: introduce LIBSMARTCOLS_JSON environment argument
WanBingjiang [Thu, 5 Feb 2026 09:11:06 +0000 (17:11 +0800)] 
column: introduce LIBSMARTCOLS_JSON environment argument

4 months agojsonwrt: support Compact JSON format output
WanBingjiang [Thu, 5 Feb 2026 08:53:29 +0000 (16:53 +0800)] 
jsonwrt: support Compact JSON format output

4 months agolibsmartcols: support JSON Lines format output
WanBingjiang [Thu, 5 Feb 2026 09:02:39 +0000 (17:02 +0800)] 
libsmartcols: support JSON Lines format output

4 months agochoom: (testcoverage) add long options tests
Christian Goeschel Ndjomouo [Sun, 22 Feb 2026 03:04:38 +0000 (22:04 -0500)] 
choom: (testcoverage) add long options tests

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
4 months agoblkid: (testcoverage) add more long option tests
Christian Goeschel Ndjomouo [Sun, 22 Feb 2026 02:09:27 +0000 (21:09 -0500)] 
blkid: (testcoverage) add more long option tests

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 months agoblkdiscard: (tests) add more long option tests
Christian Goeschel Ndjomouo [Sat, 21 Feb 2026 01:34:50 +0000 (20:34 -0500)] 
blkdiscard: (tests) add more long option tests

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 months agoFix formatting in getino.1.adoc
Mario Blättermann [Fri, 20 Feb 2026 12:47:36 +0000 (13:47 +0100)] 
Fix formatting in getino.1.adoc

5 months agolsmem: fix missing zone info when memory blocks start at an index other than 0
Christian Goeschel Ndjomouo [Fri, 20 Feb 2026 00:02:09 +0000 (19:02 -0500)] 
lsmem: fix missing zone info when memory blocks start at an index other than 0

On systems that have an uncommon physical memory layout, e.g. where hotpluggable
memory blocks start at an offset greater than 0, we failed to set the 'have_zones'
control flag, which caused an omission of the ZONES information of the listed
individual memory block or a block range. This is because we explicitly tested for
/sys/devices/system/memory/memory0/valid_zones, however it is better to simply
look for any memory<n> directory entry and validate the existence of the valid_zones
attribute.

Closes: #4055
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
5 months agologin: Fix signal race in child handling
Tobias Stoeckmann [Thu, 19 Feb 2026 19:58:10 +0000 (20:58 +0100)] 
login: Fix signal race in child handling

Two cases exist in which login might send signals to a process which is
actually not a child process:

- If SIGCHLD is set to SIG_IGN by login's parent process (unlikely),
  then no zombie process exists. The kernel could already reuse the PID
  for another process just before login's signal_handler function sends
  a signal to its stored child PID -- which was already reused
- If wait succeeds, the PID can be reused by the kernel for another
  process. The registered signal_handlers could still use the stored
  child PID to send signals -- but erroneously to a wrong process

Fix these cases by blocking and unblocking SIGCHLD and signal_handler
triggering signals around the wait call. Set child_pid to 0 after wait
succeeded and before signal_handler signals are unblocked again.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agolib/pager: Gracefully handle SIGPIPE errors
Tobias Stoeckmann [Thu, 19 Feb 2026 17:16:32 +0000 (18:16 +0100)] 
lib/pager: Gracefully handle SIGPIPE errors

A user might prematurely close the pager before the parent wrote its
full output into the pipe. This triggers SIGPIPE, which would eventually
lead to an error return value.

The programs dmesg and fdisk can keep running just fine in these cases.
In fact, dmesg's source code was already prepared for EPIPE error return
values.

If the pager returns with a success return value, ignore SIGPIPE. If
there was an error within the pager, stop the parent as well.

With this, dmesg does not return an error anymore if the ring buffer was
not fully sent to the pager before it was closed.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agodmesg: Gracefully handle EPIPE errors
Tobias Stoeckmann [Thu, 19 Feb 2026 17:14:23 +0000 (18:14 +0100)] 
dmesg: Gracefully handle EPIPE errors

Just calling exit with a success return value in case of an EPIPE error
in safe_fwrite is not precise enough. If dmesg was called with "-c",
i.e. to print and then clear the ring buffer, a successful return value
should mean that the ring buffer is cleared as well.

Instead, continue operation on EPIPE error but stop any further regular
output.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agodmesg: Register pager_close as exit handler
Tobias Stoeckmann [Thu, 19 Feb 2026 17:13:25 +0000 (18:13 +0100)] 
dmesg: Register pager_close as exit handler

Make sure that pager is properly closed even in case of err/errx calls
while pager is running.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agoMerge branch 'pg_warn' of https://github.com/stoeckmann/util-linux
Karel Zak [Thu, 19 Feb 2026 12:18:26 +0000 (13:18 +0100)] 
Merge branch 'pg_warn' of https://github.com/stoeckmann/util-linux

* 'pg_warn' of https://github.com/stoeckmann/util-linux:
  pg: Fix compiler warning

5 months agoMerge branch 'PR/setpriv-apparmor-exec' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 19 Feb 2026 11:59:45 +0000 (12:59 +0100)] 
Merge branch 'PR/setpriv-apparmor-exec' of https://github.com/karelzak/util-linux-work

* 'PR/setpriv-apparmor-exec' of https://github.com/karelzak/util-linux-work:
  setpriv: use AppArmor LSM-specific proc interface

5 months agoMerge branch 'PR/agetty-netlink-cloexec' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 19 Feb 2026 11:59:26 +0000 (12:59 +0100)] 
Merge branch 'PR/agetty-netlink-cloexec' of https://github.com/karelzak/util-linux-work

* 'PR/agetty-netlink-cloexec' of https://github.com/karelzak/util-linux-work:
  lib/netlink: set SOCK_CLOEXEC on netlink socket

5 months agoMerge branch 'PR/blkid-btrfs-zone-cleanup' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 19 Feb 2026 11:59:02 +0000 (12:59 +0100)] 
Merge branch 'PR/blkid-btrfs-zone-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/blkid-btrfs-zone-cleanup' of https://github.com/karelzak/util-linux-work:
  libblkid: (btrfs) use BTRFS_NR_SB_LOG_ZONES and rep->zones

5 months agologin: use original FQDN for PAM_RHOST
Karel Zak [Thu, 19 Feb 2026 11:20:28 +0000 (12:20 +0100)] 
login: use original FQDN for PAM_RHOST

When login -h <remotehost> is invoked, init_remote_info() strips the
local domain suffix from the hostname (FQDN to short name) before
storing it in cxt->hostname. This truncated value is then used for
PAM_RHOST, which can bypass pam_access host deny rules that match on
the FQDN.

Preserve the original -h hostname in a new cmd_hostname field and use
it for PAM_RHOST, while keeping the truncated hostname for utmp/wtmp
and logging unchanged.

Note, the real-world impact is low -- login -h is only used by legacy
telnet/rlogin daemons, and exploitation requires FQDN-specific
pam_access rules on a system still using these obsolete services.

Reported-by: Asim Viladi Oglu Manizada <manizada@pm.me>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agolib/fileeq: Prevent OOB with short read files
Tobias Stoeckmann [Wed, 18 Feb 2026 17:04:54 +0000 (18:04 +0100)] 
lib/fileeq: Prevent OOB with short read files

Using the Linux Crypto API stores hash sums of read chunks in memory. It
trusts that get_digest is called as often as "read blocks" exist in file.

It becomes an issue with files which have less content than st_size
suggests, e.g. files in sysfs. Eventually, the iterator n will be
eq->blocksmax, because the EOF is never noticed. Writing this next hash
sum into memory would lead to an out of boundary write.

Verify that n is less than eq->blocksmax. If this is not true anymore,
treat it as an error so files are considered to be not equal. This is
much safer than erroneously treating them as equal.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agolib/fileeq: Extend debug message
Tobias Stoeckmann [Wed, 18 Feb 2026 20:10:21 +0000 (21:10 +0100)] 
lib/fileeq: Extend debug message

Log how many bytes were actually read, not just how many were requested.
This difference occurs for files smaller than 32 bytes.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agolib/fileeq: Fix formatters
Tobias Stoeckmann [Wed, 18 Feb 2026 20:10:06 +0000 (21:10 +0100)] 
lib/fileeq: Fix formatters

Use formatters for given data types.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agolib/fileeq: Fix typos
Tobias Stoeckmann [Wed, 18 Feb 2026 17:15:02 +0000 (18:15 +0100)] 
lib/fileeq: Fix typos

Fix grammar and typos in comments. No functional change.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agopg: Fix compiler warning
Tobias Stoeckmann [Wed, 18 Feb 2026 17:26:52 +0000 (18:26 +0100)] 
pg: Fix compiler warning

Seen compiler warning with GCC 15.2.1 and glibc 2.43:
```
text-utils/pg.c: In function ‘prompt’:
text-utils/pg.c:621:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  621 |                 if ((p = strstr(pstring, "%d")) == NULL) {
      |                        ^
```

This happens if strstr is actually a preprocessor definition with a
__glibc_const_generic. For this, __GLIBC_USE (ISOC23) must be true.

Setting the pointer to const does not hurt and clarifies that the
content is not modfied.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agoMerge branch 'PR/pidfd-utils-have-defines' of https://github.com/karelzak/util-linux...
Karel Zak [Wed, 18 Feb 2026 11:36:16 +0000 (12:36 +0100)] 
Merge branch 'PR/pidfd-utils-have-defines' of https://github.com/karelzak/util-linux-work

* 'PR/pidfd-utils-have-defines' of https://github.com/karelzak/util-linux-work:
  pidfd-utils: move USE_PIDFD_INO_SUPPORT after syscall fallbacks
  pidfd-utils: define HAVE_PIDFD_* when syscall fallbacks are used

5 months agonsenter: use USE_NAMESPACE_ID_SUPPORT macro for nsid feature
Karel Zak [Wed, 18 Feb 2026 09:59:30 +0000 (10:59 +0100)] 
nsenter: use USE_NAMESPACE_ID_SUPPORT macro for nsid feature

Replace direct HAVE_STRUCT_NSFS_FILE_HANDLE ifdefs with a
feature-specific USE_NAMESPACE_ID_SUPPORT macro that also
requires HAVE_PIDFD_OPEN, since the namespace ID support
depends on pidfd_open().

Addresses: https://github.com/util-linux/util-linux/pull/4044
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agonsenter: fix minor issues with namespace ID support
Karel Zak [Wed, 18 Feb 2026 09:47:19 +0000 (10:47 +0100)] 
nsenter: fix minor issues with namespace ID support

- fix pidfd_self FD leak when ioctl(PIDFD_GET_MNT_NAMESPACE) fails
- fix "namesapces" typo in man page
- document "./" disambiguation for files starting with ":"
- use standard C initializer = { 0 } instead of = {}

Addresses: https://github.com/util-linux/util-linux/pull/4044
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agopidfd-utils: move USE_PIDFD_INO_SUPPORT after syscall fallbacks
Karel Zak [Wed, 18 Feb 2026 09:34:46 +0000 (10:34 +0100)] 
pidfd-utils: move USE_PIDFD_INO_SUPPORT after syscall fallbacks

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agopidfd-utils: define HAVE_PIDFD_* when syscall fallbacks are used
Karel Zak [Wed, 18 Feb 2026 09:30:25 +0000 (10:30 +0100)] 
pidfd-utils: define HAVE_PIDFD_* when syscall fallbacks are used

Follow the pattern already used in fileutils.h for close_range() and
statx().

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agonsenter: Support specifying namespace by ID
Xiao Liang [Sat, 14 Feb 2026 03:23:42 +0000 (11:23 +0800)] 
nsenter: Support specifying namespace by ID

Linux kernel v6.19 introduces listns() syscall that lists namespace IDs,
as well as the support for opening an nsfile by a file_handle of ns ID.

This patch allows specifying namespaces by ID for nsenter. For example:

  # nsenter --net=:7

enters init net namespace (7 for NET_NS_INIT_ID).

In the rare case that a ns file name starts with a colon, prepend "./"
for disambiguation.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
5 months agolsblk: improve error reporting for invalid device paths
Sina Abroshan [Sun, 15 Feb 2026 08:34:17 +0000 (12:04 +0330)] 
lsblk: improve error reporting for invalid device paths

Differentiate stat() failures from non-block-device cases,
so users get accurate errno-based error messages.

Signed-off-by: Sina Abroshan <sina.abroshan@gmail.com>
5 months agosetpriv: use AppArmor LSM-specific proc interface
Karel Zak [Tue, 17 Feb 2026 11:33:58 +0000 (12:33 +0100)] 
setpriv: use AppArmor LSM-specific proc interface

Remove the check for /sys/kernel/security/apparmor (securityfs) before
writing to the proc attr interface. The securityfs check fails in
environments where AppArmor is enabled but securityfs is not mounted
(e.g., containers, WSL2, embedded systems).

Use the LSM-specific /proc/self/attr/apparmor/exec interface introduced
in Linux 5.8 (kernel commit 6413f852ce08) which is not affected by LSM
load ordering issues. Fall back to the legacy /proc/self/attr/exec for
older kernels.

Fixes: https://github.com/util-linux/util-linux/issues/4033
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agolib/netlink: set SOCK_CLOEXEC on netlink socket
Karel Zak [Tue, 17 Feb 2026 10:35:17 +0000 (11:35 +0100)] 
lib/netlink: set SOCK_CLOEXEC on netlink socket

Set SOCK_CLOEXEC when creating the NETLINK_ROUTE socket in
ul_nl_open() to prevent the file descriptor from leaking to
child processes across execv().

In agetty, the netlink socket used to monitor IP address changes
for \4/\6 issue escapes was inherited by the login program, causing
SELinux AVC denials (local_login_t denied read/write on getty_t's
netlink_route_socket).

Fixes: https://github.com/util-linux/util-linux/issues/4032
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agolibblkid: (btrfs) use BTRFS_NR_SB_LOG_ZONES and rep->zones
Karel Zak [Tue, 17 Feb 2026 10:20:38 +0000 (11:20 +0100)] 
libblkid: (btrfs) use BTRFS_NR_SB_LOG_ZONES and rep->zones

Use the BTRFS_NR_SB_LOG_ZONES constant instead of a hardcoded 2 when
calling blkdev_get_zonereport() to be consistent with the rest of the
function that already uses this constant.

Replace the pointer arithmetic (struct blk_zone *)(rep + 1) with the
more readable rep->zones flexible array member access.

Addresses: https://github.com/util-linux/util-linux/pull/3995
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'master-branch-1' of https://github.com/Leefancy/util-linux
Karel Zak [Tue, 17 Feb 2026 10:17:50 +0000 (11:17 +0100)] 
Merge branch 'master-branch-1' of https://github.com/Leefancy/util-linux

* 'master-branch-1' of https://github.com/Leefancy/util-linux:
  blkdev: Correct zone report size calculation

5 months agoblkid: move error checks before JSON output initialization
Karel Zak [Tue, 17 Feb 2026 10:09:09 +0000 (11:09 +0100)] 
blkid: move error checks before JSON output initialization

Move the lowprobe and lookup error checks (missing device and missing
search type) before the JSON writer initialization. This prevents
partial JSON output being written to stdout before errx() terminates
the program.

Addresses: https://github.com/util-linux/util-linux/pull/4036
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'master' of https://github.com/aschnell/util-linux
Karel Zak [Tue, 17 Feb 2026 09:56:23 +0000 (10:56 +0100)] 
Merge branch 'master' of https://github.com/aschnell/util-linux

* 'master' of https://github.com/aschnell/util-linux:
  avoid repetitive code
  always use array with name in json output
  updated test case
  include device in json output and use json array when needed

5 months agoMerge branch 'PR/prlimit-nofile-error' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 17 Feb 2026 09:37:02 +0000 (10:37 +0100)] 
Merge branch 'PR/prlimit-nofile-error' of https://github.com/karelzak/util-linux-work

* 'PR/prlimit-nofile-error' of https://github.com/karelzak/util-linux-work:
  prlimit: raise a nicer error message when modifying NOFILE

5 months agopager: remove stale pager_redirect() declaration
Karel Zak [Tue, 17 Feb 2026 09:32:15 +0000 (10:32 +0100)] 
pager: remove stale pager_redirect() declaration

The pager_redirect() function was removed in the previous commit,
but its declaration in the header was left behind. Remove it.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agolib/pager: Drop pager_redirect
Tobias Stoeckmann [Mon, 16 Feb 2026 20:54:24 +0000 (21:54 +0100)] 
lib/pager: Drop pager_redirect

The pager_redirect function was only used in dmesg. Since it is no
longer used there, drop it from lib/pager.c as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agodmesg: Keep error messages in parent's stderr
Tobias Stoeckmann [Mon, 16 Feb 2026 20:53:02 +0000 (21:53 +0100)] 
dmesg: Keep error messages in parent's stderr

If dmesg uses a pager, some of its error messages end up in the pager
output. Use the pager only for data that is supposed to be paged and
print error messages before the pager is started or after it is shut
down again.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agoavoid repetitive code
Arvin Schnell [Mon, 16 Feb 2026 15:34:04 +0000 (16:34 +0100)] 
avoid repetitive code

5 months agoalways use array with name in json output
Arvin Schnell [Mon, 16 Feb 2026 14:54:11 +0000 (15:54 +0100)] 
always use array with name in json output

5 months agoprlimit: raise a nicer error message when modifying NOFILE
Karel Zak [Mon, 16 Feb 2026 13:43:00 +0000 (14:43 +0100)] 
prlimit: raise a nicer error message when modifying NOFILE

When attempting to set RLIMIT_NOFILE to a value exceeding the kernel's
fs.nr_open limit, prlimit(2) returns EPERM. This can mislead users into
thinking they need elevated permissions, even when running as root.

Add a check to detect when the requested NOFILE limit exceeds
fs.nr_open and provide a clear error message indicating the actual
constraint. The check is optional: if /proc/sys/fs/nr_open cannot be
read (e.g., /proc not mounted), the validation is silently skipped to
avoid introducing a hard dependency on /proc.

The nr_open value is cached and read only once per prlimit invocation
for efficiency when setting multiple limits.

Addresses: https://github.com/util-linux/util-linux/issues/4017
Co-authored-by: krajpuro <krajpuro@akamai.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'master' of https://github.com/add-uos/util-linux
Karel Zak [Mon, 16 Feb 2026 13:21:32 +0000 (14:21 +0100)] 
Merge branch 'master' of https://github.com/add-uos/util-linux

* 'master' of https://github.com/add-uos/util-linux:
  style: convert tabs to spaces in meson.build

5 months agolibuuid: reset initial cont-clock time on service start
Michael Trapp [Tue, 10 Feb 2026 14:39:21 +0000 (15:39 +0100)] 
libuuid: reset initial cont-clock time on service start

When uuidd starts with --cont-clock enabled and reads a stale timestamp
from the state file, the continuous clock logic would apply a backwards
offset (default 2 hours), causing generated UUIDs to have incorrect
timestamps in the past.

Fix this by resetting last_clock_reg to the current time when the saved
timestamp is older than the current clock. This prevents the backwards
offset from being applied at service start.

[kzak@redhat.com: - fix comment, add commit message]

Fixes: https://github.com/util-linux/util-linux/issues/4018
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoblkzone: make N/A string translatable
Karel Zak [Mon, 16 Feb 2026 12:30:55 +0000 (13:30 +0100)] 
blkzone: make N/A string translatable

The "N/A" string for write pointer should be marked for translation
to support localization, following the pattern used elsewhere in
util-linux (e.g., blockdev.c).

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'wilfred/blkzone-report-wptr' of https://github.com/twilfredo/util-linux
Karel Zak [Mon, 16 Feb 2026 12:25:20 +0000 (13:25 +0100)] 
Merge branch 'wilfred/blkzone-report-wptr' of https://github.com/twilfredo/util-linux

* 'wilfred/blkzone-report-wptr' of https://github.com/twilfredo/util-linux:
  blkzone: don't show wptr when zones are full

5 months agoMerge branch 'patch-26' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 16 Feb 2026 12:19:01 +0000 (13:19 +0100)] 
Merge branch 'patch-26' of https://github.com/mariobl/util-linux

* 'patch-26' of https://github.com/mariobl/util-linux:
  Fix various typos and markup in man pages
  Fix typo in flock.1.adoc

5 months agotests: add tests for column --table-header-as-columns
Karel Zak [Mon, 16 Feb 2026 10:22:12 +0000 (11:22 +0100)] 
tests: add tests for column --table-header-as-columns

Add test coverage for the --table-header-as-columns (-K) option
added in PR #4003.

Tests cover:
- Basic tab-separated input with header line
- CSV input with comma separator
- JSON output with header-derived column names
- Empty column names in header

Addresses: https://github.com/util-linux/util-linux/pull/4003
Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'feat/3971' of https://github.com/echoechoin/util-linux
Karel Zak [Mon, 16 Feb 2026 10:11:59 +0000 (11:11 +0100)] 
Merge branch 'feat/3971' of https://github.com/echoechoin/util-linux

* 'feat/3971' of https://github.com/echoechoin/util-linux:
  column: add bash-completion for table-header-as-columns
  column: add option '--table-header-as-columns' for using first line as table columns names.

5 months agolib/pager: Rename caught_signal to pager_caught_signal
Karel Zak [Mon, 16 Feb 2026 09:45:27 +0000 (10:45 +0100)] 
lib/pager: Rename caught_signal to pager_caught_signal

The variable name caught_signal is too generic. Rename it to
pager_caught_signal to follow the existing naming convention in the
file where pager-related static variables use the pager_ prefix
(pager_process, pager_argv, etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'pager_fd' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 16 Feb 2026 09:44:03 +0000 (10:44 +0100)] 
Merge branch 'pager_fd' of https://github.com/stoeckmann/util-linux

* 'pager_fd' of https://github.com/stoeckmann/util-linux:
  lib/pager: Use original stderr in pager_close
  lib/pager: Use pager_open/close for pager_redirect
  lib/pager: Clear potential stdout/stderr errors
  lib/pager: Flush outputs in pager_close
  lib/pager: Improve signal handling in pager_close

5 months agoMerge branch 'pager_leak' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 16 Feb 2026 09:31:34 +0000 (10:31 +0100)] 
Merge branch 'pager_leak' of https://github.com/stoeckmann/util-linux

* 'pager_leak' of https://github.com/stoeckmann/util-linux:
  lib/pager: Release resources on pager_open error

5 months agodmesg: update prepare_buffer() comment
Karel Zak [Mon, 16 Feb 2026 09:18:56 +0000 (10:18 +0100)] 
dmesg: update prepare_buffer() comment

The function was renamed from process_buffer() to prepare_buffer()
and no longer handles printing. Update the comment to reflect that
it only reads and prepares the message buffer.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'dmesg_io_split' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 16 Feb 2026 09:16:51 +0000 (10:16 +0100)] 
Merge branch 'dmesg_io_split' of https://github.com/stoeckmann/util-linux

5 months agodmesg: improve buffer size error message
Karel Zak [Mon, 16 Feb 2026 09:04:43 +0000 (10:04 +0100)] 
dmesg: improve buffer size error message

Improve the error message when buffer size is too large to include
the maximum allowed size. This helps users understand what the actual
limit is rather than just reporting an invalid value.

Before: invalid buffer size argument: '...'
After: buffer size ... is too large (maximum is ...)

Signed-off-by: Karel Zak <kzak@redhat.com>
5 months agoMerge branch 'dmesg32' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 16 Feb 2026 09:00:01 +0000 (10:00 +0100)] 
Merge branch 'dmesg32' of https://github.com/stoeckmann/util-linux

* 'dmesg32' of https://github.com/stoeckmann/util-linux:
  dmesg: Fix short memory allocation with 32 bit

5 months agoMerge branch 'lsfd--SIOCGSKNS-based-SOCK_NETNS' of https://github.com/masatake/util...
Karel Zak [Mon, 16 Feb 2026 08:58:17 +0000 (09:58 +0100)] 
Merge branch 'lsfd--SIOCGSKNS-based-SOCK_NETNS' of https://github.com/masatake/util-linux

* 'lsfd--SIOCGSKNS-based-SOCK_NETNS' of https://github.com/masatake/util-linux:
  lsfd: fill SOCK.NETNS even when sock_diag netlink can't report sockets
  tests: (test_mkfds:netns) conditionally report EPERM when ioctl(SIOCGSKNS) fails
  tests: (test_mkfd::tcp-bare) new factory creating an unbound/unconnected TCP socket
  lsfd: add inspect_target_fd method to file_class
  lsfd: (refactor) make call_with_foreign_fd reusable
  lsfd: make pidfd for the target process available while collecting fds
  lsfd: (comment) update the description of sock_xinfo::netns_inode
  lsfd: (cosmetic) delete an empty line

5 months agoupdated test case
Arvin Schnell [Fri, 13 Feb 2026 11:06:02 +0000 (12:06 +0100)] 
updated test case

5 months agoinclude device in json output and use json array when needed
Arvin Schnell [Fri, 13 Feb 2026 10:43:16 +0000 (11:43 +0100)] 
include device in json output and use json array when needed

5 months agoblkzone: don't show wptr when zones are full
Wilfred Mallawa [Thu, 12 Feb 2026 03:02:03 +0000 (13:02 +1000)] 
blkzone: don't show wptr when zones are full

blkzone report displays the write pointer when zones are full, however, the
writepointer value is not accurate for full zones as all zone LBAs have been
written. Instead, fix this so that we show "N/A" for the writepointer field
if the zone condition is full.

While we are at it, extend this behavior for convetional zones instead
of displaying 0 for the writepointer.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
5 months agoFix various typos and markup in man pages
Mario Blättermann [Tue, 10 Feb 2026 13:38:36 +0000 (14:38 +0100)] 
Fix various typos and markup in man pages

5 months agoFix typo in flock.1.adoc
Mario Blättermann [Tue, 10 Feb 2026 11:56:32 +0000 (12:56 +0100)] 
Fix typo in flock.1.adoc

5 months agocolumn: add bash-completion for table-header-as-columns
WanBingjiang [Fri, 30 Jan 2026 12:36:57 +0000 (20:36 +0800)] 
column: add bash-completion for table-header-as-columns

5 months agocolumn: add option '--table-header-as-columns' for using first line as table columns...
WanBingjiang [Fri, 30 Jan 2026 09:28:13 +0000 (17:28 +0800)] 
column: add option '--table-header-as-columns' for using first line as table columns names.

5 months agostyle: convert tabs to spaces in meson.build
zhanghongyuan [Wed, 4 Feb 2026 13:42:57 +0000 (21:42 +0800)] 
style: convert tabs to spaces in meson.build

5 months agolib/pager: Use original stderr in pager_close
Tobias Stoeckmann [Wed, 4 Feb 2026 19:46:57 +0000 (20:46 +0100)] 
lib/pager: Use original stderr in pager_close

Having restored stdout/stderr before calling wait_for_pager allows
potential error messages to be printed on terminal instead of being lost
due to an already closed pipe stderr.

Although dup2 closes the target descriptor, make sure that the pipe
is closed even if dup2 fails.

With everything in place, call exit after restoring the original signal
handlers. This way, signals received between wait_for_pager and signal
restoration are processed as well. A race condition exists if multiple
signals are received, which would allow original handlers to be
processed before exit is called, yet the overhead of properly blocking
signals and unblocking them is most likely not worth the effort.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 months agolib/pager: Use pager_open/close for pager_redirect
Tobias Stoeckmann [Wed, 4 Feb 2026 20:45:48 +0000 (21:45 +0100)] 
lib/pager: Use pager_open/close for pager_redirect

Restore original stdout/stderr for pager_redirect as well to support
atexit handlers of parent which might use these descriptors.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>