]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 days agolib: (pidfd-utils.c) set __unused__ in right way master
Karel Zak [Wed, 10 Dec 2025 11:09:44 +0000 (12:09 +0100)] 
lib: (pidfd-utils.c) set __unused__ in right way

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agoMerge branch 'fix/consolidate_validate_pfd_ino' of https://github.com/cgoesche/util...
Karel Zak [Wed, 10 Dec 2025 11:01:06 +0000 (12:01 +0100)] 
Merge branch 'fix/consolidate_validate_pfd_ino' of https://github.com/cgoesche/util-linux-fork

* 'fix/consolidate_validate_pfd_ino' of https://github.com/cgoesche/util-linux-fork:
  lib: (pidutils.c) use uint64_t instead of ino_t for seamless cross-compatibility
  kill: use uint64_t as type for kill_control->pidfd_ino
  lib: (pidfd-utils.c) remove extraneous _GNU_SOURCE feature test macro
  lib: (pidfd-utils) new helper function to retrieve pidfd inode number
  lib: (pidfd-utils.c) add a helper routine to check the pidfd fs type
  kill: replace USE_KILL_WITH_PIDFD_INO ifdef with USE_PIDFD_INO_SUPPORT
  include: (pidfd-utils.h) conditionally define pidfd inode support
  libmount: add pidfs magic number for fstype check
  include: (statfs_magic.h) add pidfs magic number
  kill: use ul_get_valid_pidfd_or_err() to validate user provided pidfd inodes
  include: add helper routines for opening and validating pidfds

5 days agolibblkid: Keep NTFS name unmodified and mount driver independent
Karel Zak [Tue, 9 Dec 2025 12:12:41 +0000 (13:12 +0100)] 
libblkid: Keep NTFS name unmodified and mount driver independent

We need stable filesystem names (types) even though there are multiple
filesystem drivers. libmount now provides a way to map the stable
fs-types to various mount-types.

References: 4cd429fdcd3e7db1d031494987d5cf7411689d79
Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agolibmount: add option to override fs-type with mount-type
Karel Zak [Tue, 9 Dec 2025 12:02:11 +0000 (13:02 +0100)] 
libmount: add option to override fs-type with mount-type

This patch introduces an internal libmount method to convert fs-type
(as provided by libblkid or udevd) to mount-type to specify a different
mount driver.

Currently, the mapping from fs-type to mount-type is hardcoded in
libmount as a temporary solution. The final implementation should
provide configuration files (e.g., /etc/mount/fs.d/<name>) for these
mappings.

The current default mapping is implemented only for NTFS. It can be
modified during compilation with:

 ./configure --with-ntfs-mounttype=TYPE
or
 meson setup build -D ntfs-mounttype=TYPE

The default is "ntfs3".

Addresses: https://github.com/util-linux/util-linux/pull/3618
Addresses: https://github.com/systemd/systemd/pull/39982
Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agolibmount: read from udev, add --disable-libmount-udev-support
Karel Zak [Tue, 25 Nov 2025 11:56:07 +0000 (12:56 +0100)] 
libmount: read from udev, add --disable-libmount-udev-support

The library traditionally uses libblkid to obtain device properties
(such as FS-type if not specified). This can be a relatively costly
operation to scan the device and requires read access to the device.

All relevant libblkid information is usually cached by the udev DB.
This commit adds the possibility to reuse the information from udev,
with a fallback to libblkid if udev is not available.

The commit also adds

 $ ./configure --disable-libmount-udev-support
 $ meson setup build -Dbuild-libmount-udev-support=disabled

to completely disable this feature and avoid libmount's dependence
on libsystemd.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agolibmount: enhance readability of read_from_blkid()
Karel Zak [Mon, 24 Nov 2025 15:57:50 +0000 (16:57 +0100)] 
libmount: enhance readability of read_from_blkid()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agolibmount: refactor mnt_cache_read_tags()
Karel Zak [Mon, 24 Nov 2025 08:54:20 +0000 (09:54 +0100)] 
libmount: refactor mnt_cache_read_tags()

Split the function into smaller functions to make it easier to read
and extend in the future.

Introduce a struct to hold all variants of tag names, including udev
names in the future.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agolibmount: refactor mnt_get_fstype()
Karel Zak [Mon, 24 Nov 2025 08:42:09 +0000 (09:42 +0100)] 
libmount: refactor mnt_get_fstype()

Move the current code into two small functions to improve readability
and facilitate future extensions.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agoMerge branch 'fix/procfs_extraneous_return' of https://github.com/cgoesche/util-linux...
Karel Zak [Mon, 8 Dec 2025 11:17:27 +0000 (12:17 +0100)] 
Merge branch 'fix/procfs_extraneous_return' of https://github.com/cgoesche/util-linux-fork

* 'fix/procfs_extraneous_return' of https://github.com/cgoesche/util-linux-fork:
  lib: (procfs.c) remove extraneous return statement

6 days agoMerge branch 'fix/login_shell_arg_null_str' of https://github.com/cgoesche/util-linux...
Karel Zak [Mon, 8 Dec 2025 08:59:41 +0000 (09:59 +0100)] 
Merge branch 'fix/login_shell_arg_null_str' of https://github.com/cgoesche/util-linux-fork

* 'fix/login_shell_arg_null_str' of https://github.com/cgoesche/util-linux-fork:
  login: duplicate --shell argument to avoid nulling through explicit_bzero()

10 days agolib: (procfs.c) remove extraneous return statement
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 19:00:32 +0000 (14:00 -0500)] 
lib: (procfs.c) remove extraneous return statement

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agolib: (pidutils.c) use uint64_t instead of ino_t for seamless cross-compatibility
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 18:37:57 +0000 (13:37 -0500)] 
lib: (pidutils.c) use uint64_t instead of ino_t for seamless cross-compatibility

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agokill: use uint64_t as type for kill_control->pidfd_ino
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 18:35:21 +0000 (13:35 -0500)] 
kill: use uint64_t as type for kill_control->pidfd_ino

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agolib: (pidfd-utils.c) remove extraneous _GNU_SOURCE feature test macro
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 15:16:25 +0000 (10:16 -0500)] 
lib: (pidfd-utils.c) remove extraneous _GNU_SOURCE feature test macro

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agolib: (pidfd-utils) new helper function to retrieve pidfd inode number
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 04:47:16 +0000 (23:47 -0500)] 
lib: (pidfd-utils) new helper function to retrieve pidfd inode number

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agolib: (pidfd-utils.c) add a helper routine to check the pidfd fs type
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 03:59:54 +0000 (22:59 -0500)] 
lib: (pidfd-utils.c) add a helper routine to check the pidfd fs type

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agokill: replace USE_KILL_WITH_PIDFD_INO ifdef with USE_PIDFD_INO_SUPPORT
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 01:45:05 +0000 (20:45 -0500)] 
kill: replace USE_KILL_WITH_PIDFD_INO ifdef with USE_PIDFD_INO_SUPPORT

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agoinclude: (pidfd-utils.h) conditionally define pidfd inode support
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 01:38:11 +0000 (20:38 -0500)] 
include: (pidfd-utils.h) conditionally define pidfd inode support

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agolibmount: add pidfs magic number for fstype check
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 01:31:37 +0000 (20:31 -0500)] 
libmount: add pidfs magic number for fstype check

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agoinclude: (statfs_magic.h) add pidfs magic number
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 01:27:22 +0000 (20:27 -0500)] 
include: (statfs_magic.h) add pidfs magic number

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agokill: use ul_get_valid_pidfd_or_err() to validate user provided pidfd inodes
Christian Goeschel Ndjomouo [Tue, 25 Nov 2025 04:54:39 +0000 (23:54 -0500)] 
kill: use ul_get_valid_pidfd_or_err() to validate user provided pidfd inodes

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agoinclude: add helper routines for opening and validating pidfds
Christian Goeschel Ndjomouo [Tue, 25 Nov 2025 04:26:48 +0000 (23:26 -0500)] 
include: add helper routines for opening and validating pidfds

With the new ul_get_valid_pidfd_or_err() routine util-linux
tools can now simply validate pidfd inode numbers before
opening a file descriptor for a given PID.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agoMerge branch 'PR/column-input-separator-alias' of https://github.com/karelzak/util...
Karel Zak [Thu, 4 Dec 2025 17:41:44 +0000 (18:41 +0100)] 
Merge branch 'PR/column-input-separator-alias' of https://github.com/karelzak/util-linux-work

* 'PR/column-input-separator-alias' of https://github.com/karelzak/util-linux-work:
  column: add --input-separator as an alias for --separator

10 days agologin: duplicate --shell argument to avoid nulling through explicit_bzero()
Christian Goeschel Ndjomouo [Thu, 4 Dec 2025 17:02:30 +0000 (12:02 -0500)] 
login: duplicate --shell argument to avoid nulling through explicit_bzero()

Addresses: #3855
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 days agogithub: revert actions/checkout for ubuntu 18.04
Karel Zak [Thu, 4 Dec 2025 15:58:28 +0000 (16:58 +0100)] 
github: revert actions/checkout for ubuntu 18.04

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoMerge branch 'feat/login_shell_option' of https://github.com/cgoesche/util-linux...
Karel Zak [Thu, 4 Dec 2025 13:26:40 +0000 (14:26 +0100)] 
Merge branch 'feat/login_shell_option' of https://github.com/cgoesche/util-linux-fork

* 'feat/login_shell_option' of https://github.com/cgoesche/util-linux-fork:
  login: document -s and --shell on the man page
  login: define shell to log in to with -s or --shell

10 days agoMerge branch 'update_guid_zfs' of https://github.com/mminkus/util-linux
Karel Zak [Thu, 4 Dec 2025 13:25:52 +0000 (14:25 +0100)] 
Merge branch 'update_guid_zfs' of https://github.com/mminkus/util-linux

* 'update_guid_zfs' of https://github.com/mminkus/util-linux:
  libfdisk: modernize ZFS GPT type description

11 days agologin: document -s and --shell on the man page
Christian Goeschel Ndjomouo [Thu, 27 Nov 2025 04:07:14 +0000 (23:07 -0500)] 
login: document -s and --shell on the man page

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
11 days agologin: define shell to log in to with -s or --shell
Christian Goeschel Ndjomouo [Thu, 27 Nov 2025 03:52:21 +0000 (22:52 -0500)] 
login: define shell to log in to with -s or --shell

The -s and --shell options allow a user to define a shell
to log in to other than the one defined it the passwd entry
or _PATH_BSHELL.

Addresses: #3855
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
11 days agoMerge branch 'fix/issue_3865' of https://github.com/lord2y/util-linux
Karel Zak [Wed, 3 Dec 2025 10:40:57 +0000 (11:40 +0100)] 
Merge branch 'fix/issue_3865' of https://github.com/lord2y/util-linux

* 'fix/issue_3865' of https://github.com/lord2y/util-linux:
  login-utils, sys-utils: use _PATH_BSHELL consistently
  *: use ul_default_shell() for interactive shell spawning
  lib: introduce ul_default_shell() for consistent shell resolution

11 days agoMerge remote-tracking branch 'github/dependabot/github_actions/actions/checkout-6'
Karel Zak [Wed, 3 Dec 2025 10:37:12 +0000 (11:37 +0100)] 
Merge remote-tracking branch 'github/dependabot/github_actions/actions/checkout-6'

11 days agoMerge remote-tracking branch 'github/dependabot/github_actions/actions/upload-artifact-5'
Karel Zak [Wed, 3 Dec 2025 10:36:42 +0000 (11:36 +0100)] 
Merge remote-tracking branch 'github/dependabot/github_actions/actions/upload-artifact-5'

11 days agoMerge remote-tracking branch 'github/dependabot/github_actions/github/codeql-action-4'
Karel Zak [Wed, 3 Dec 2025 10:33:17 +0000 (11:33 +0100)] 
Merge remote-tracking branch 'github/dependabot/github_actions/github/codeql-action-4'

11 days agoMerge branch 'feat/check_bash_comp_integrity' of https://github.com/cgoesche/util...
Karel Zak [Wed, 3 Dec 2025 10:14:13 +0000 (11:14 +0100)] 
Merge branch 'feat/check_bash_comp_integrity' of https://github.com/cgoesche/util-linux-fork

* 'feat/check_bash_comp_integrity' of https://github.com/cgoesche/util-linux-fork:
  bash-completion: (lslogins) fix typo in long option
  tools: (checkcompletion.sh) test the integrity of long options completion
  tools: new helper for extraction of program long options from source files

11 days agocolumn: add --input-separator as an alias for --separator
Karel Zak [Wed, 3 Dec 2025 10:11:59 +0000 (11:11 +0100)] 
column: add --input-separator as an alias for --separator

This change adds --input-separator as an alias for the existing
--separator option, providing symmetry with --output-separator.

The new alias is documented in:
- command-line help text
- man page
- bash completion

Fixes: https://github.com/util-linux/util-linux/issues/3889
Signed-off-by: Karel Zak <kzak@redhat.com>
11 days agolibfdisk: modernize ZFS GPT type description
Martin Minkus [Wed, 3 Dec 2025 03:51:05 +0000 (19:51 -0800)] 
libfdisk: modernize ZFS GPT type description

The GPT type GUID 6A898CC3-1DD2-11B2-99A6-080020736631 is currently
described as "Solaris /usr & Apple ZFS". This reflects early Solaris
and Apple experiments with ZFS, but today the same GUID is widely used
by OpenZFS implementations on Linux, illumos, FreeBSD, and other
platforms to mark ZFS pool member partitions.

Apple's ZFS work was discontinued long ago, while OpenZFS has become
the actively maintained and de facto standard implementation. Update
the human-readable description to the simpler and more accurate:

    "ZFS pool member"

A short comment is added to note the GUID’s historical Solaris /usr
origin and its brief use by Apple. Only the description string is
changed; the GUID itself and its semantics remain unchanged.

12 days agocal: add note about today highlight on -w
Karel Zak [Tue, 2 Dec 2025 15:08:38 +0000 (16:08 +0100)] 
cal: add note about today highlight on -w

Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agobuild(deps): bump actions/checkout from 1 to 6
dependabot[bot] [Mon, 1 Dec 2025 21:01:27 +0000 (21:01 +0000)] 
build(deps): bump actions/checkout from 1 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v1...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
13 days agologin-utils, sys-utils: use _PATH_BSHELL consistently
Alessandro Ratti [Sun, 23 Nov 2025 15:26:37 +0000 (16:26 +0100)] 
login-utils, sys-utils: use _PATH_BSHELL consistently

Remove local DEFAULT_SHELL definitions and hardcoded "/bin/sh" strings
in favor of the standard _PATH_BSHELL macro from <paths.h>. This
provides consistency across the codebase while following libc
conventions.

These tools already perform their own passwd lookups and only need a
fallback value, so they don't require the full ul_default_shell()
resolution logic.

Affected tools:
- su(1): already checks pw_shell validity
- sulogin(8): emergency login with explicit shell handling
- setpriv(1): already has passwd entry for environment setup

Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
13 days ago*: use ul_default_shell() for interactive shell spawning
Alessandro Ratti [Sun, 23 Nov 2025 15:24:52 +0000 (16:24 +0100)] 
*: use ul_default_shell() for interactive shell spawning

Update tools that spawn interactive shells to use ul_default_shell()
for consistent shell resolution. This ensures these tools respect both
$SHELL and the user's configured shell from the passwd database before
falling back to _PATH_BSHELL.

Affected tools:
- script(1): fixes history truncation when invoked without $SHELL
- scriptlive(1): consistent with script(1) behavior
- flock(1): for -c command execution
- more(1): for shell escape feature
- exec_shell (used by unshare(1) and nsenter(1))

This change addresses user reports of data loss due to tools defaulting
to /bin/sh instead of the user's configured shell, particularly affecting
command history with different HISTSIZE configurations.

Addresses: https://github.com/util-linux/util-linux/issues/3865
Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
13 days agolib: introduce ul_default_shell() for consistent shell resolution
Alessandro Ratti [Sun, 23 Nov 2025 15:20:57 +0000 (16:20 +0100)] 
lib: introduce ul_default_shell() for consistent shell resolution

Add a new ul_default_shell() function to provide consistent shell
resolution across util-linux tools. The function follows a priority
order: $SHELL environment variable, user's shell from passwd database,
and finally _PATH_BSHELL as fallback.

The function supports flags to control its behavior:
- UL_SHELL_NOENV: skip $SHELL environment variable check
- UL_SHELL_NOPWD: skip passwd database lookup

This addresses the issue where tools like script(1) would default to
/bin/sh without respecting the user's configured shell, potentially
causing data loss.

Addresses: https://github.com/util-linux/util-linux/issues/3865
Suggested-by: Karel Zak <kzak@redhat.com>
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
13 days agoMerge branch 'lsfd--fix-error-file-memleak' of https://github.com/masatake/util-linux
Karel Zak [Mon, 1 Dec 2025 10:21:22 +0000 (11:21 +0100)] 
Merge branch 'lsfd--fix-error-file-memleak' of https://github.com/masatake/util-linux

* 'lsfd--fix-error-file-memleak' of https://github.com/masatake/util-linux:
  lsfd: fix memory leak related to stat_error_class

13 days agoMerge branch 'master' of https://github.com/jthackray/util-linux
Karel Zak [Mon, 1 Dec 2025 10:10:11 +0000 (11:10 +0100)] 
Merge branch 'master' of https://github.com/jthackray/util-linux

* 'master' of https://github.com/jthackray/util-linux:
  lscpu: Add a few missing Arm CPU identifiers

2 weeks agolsfd: fix memory leak related to stat_error_class
Masatake YAMATO [Sat, 29 Nov 2025 19:10:46 +0000 (04:10 +0900)] 
lsfd: fix memory leak related to stat_error_class

Memory objects pointed by the name member of a file object allocate as
an instance of stat_error_class are leaked.

I intrdouced this bug in a125e2eea7cea4d0bac1404c2e1b1d65d11cc10c.  In
the commit, I arranged the class hierarchy.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 weeks agolscpu: Add a few missing Arm CPU identifiers
Jonathan Thackray [Thu, 27 Nov 2025 16:54:40 +0000 (16:54 +0000)] 
lscpu: Add a few missing Arm CPU identifiers

2 weeks agolslogins: remove duplicate errno initialization
Christian Goeschel Ndjomouo [Fri, 28 Nov 2025 06:17:03 +0000 (01:17 -0500)] 
lslogins: remove duplicate errno initialization

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (lslogins) fix typo in long option
Christian Goeschel Ndjomouo [Thu, 27 Nov 2025 05:40:54 +0000 (00:40 -0500)] 
bash-completion: (lslogins) fix typo in long option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agotools: (checkcompletion.sh) test the integrity of long options completion
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:07:56 +0000 (22:07 -0500)] 
tools: (checkcompletion.sh) test the integrity of long options completion

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agotools: new helper for extraction of program long options from source files
cgoesche [Fri, 31 Oct 2025 05:58:11 +0000 (01:58 -0400)] 
tools: new helper for extraction of program long options from source files

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agoeject: fix const qualifier warning in read_speed
Karel Zak [Thu, 27 Nov 2025 15:50:19 +0000 (16:50 +0100)] 
eject: fix const qualifier warning in read_speed

Fix const qualifier discarded warning in read_speed().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strrchr() function returns a pointer into a const string, so the
receiving variable must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agopartx: fix const qualifier warning in get_max_partno
Karel Zak [Thu, 27 Nov 2025 15:48:53 +0000 (16:48 +0100)] 
partx: fix const qualifier warning in get_max_partno

Fix const qualifier discarded warning in get_max_partno().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strrchr() function returns a pointer into a const string, so the
receiving variable must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoenosys: fix const qualifier warning in parse_block
Karel Zak [Thu, 27 Nov 2025 15:47:46 +0000 (16:47 +0100)] 
enosys: fix const qualifier warning in parse_block

Fix const qualifier discarded warning in parse_block().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strchr() function returns a pointer into a const string, so the
receiving variable must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agowhereis: fix const qualifier warnings for C23
Karel Zak [Thu, 27 Nov 2025 15:46:22 +0000 (16:46 +0100)] 
whereis: fix const qualifier warnings for C23

Fix const qualifier discarded warnings in dirlist_add_subdir() and
lookup() functions. These warnings are reported by gcc 15 which
defaults to the C23 standard.

The strchr() and strrchr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agonamei: fix const qualifier warning in readlink_to_namei
Karel Zak [Thu, 27 Nov 2025 15:44:47 +0000 (16:44 +0100)] 
namei: fix const qualifier warning in readlink_to_namei

Fix const qualifier discarded warning in readlink_to_namei().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strrchr() function returns a pointer into a const string, so the
receiving variable must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agologger: fix const qualifier warnings for C23
Karel Zak [Thu, 27 Nov 2025 15:43:38 +0000 (16:43 +0100)] 
logger: fix const qualifier warnings for C23

Fix const qualifier discarded warnings in valid_structured_data_param()
and valid_structured_data_id() functions. These warnings are reported by
gcc 15 which defaults to the C23 standard.

The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolsfd: fix const qualifier warning in strnrstr
Karel Zak [Thu, 27 Nov 2025 15:38:18 +0000 (16:38 +0100)] 
lsfd: fix const qualifier warning in strnrstr

Fix const qualifier discarded warning in strnrstr().
This warning is reported by gcc 15 which defaults to the C23 standard.

The function returns a non-const pointer into the haystack parameter,
and callers modify the string through that pointer. Therefore, the
haystack parameter should be char * rather than const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolsfd: fix const qualifier warning in new_counter_spec
Karel Zak [Thu, 27 Nov 2025 15:35:56 +0000 (16:35 +0100)] 
lsfd: fix const qualifier warning in new_counter_spec

Fix const qualifier discarded warning in new_counter_spec().
This warning is reported by gcc 15 which defaults to the C23 standard.

The function modifies the input string by inserting a null terminator
to split it into name and expression parts, so the parameter should
be char * rather than const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agodmesg: fix const qualifier warnings in parse_callerid
Karel Zak [Thu, 27 Nov 2025 15:33:04 +0000 (16:33 +0100)] 
dmesg: fix const qualifier warnings in parse_callerid

Fix const qualifier discarded warnings in parse_callerid().
These warnings are reported by gcc 15 which defaults to the C23 standard.

The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibblkid: fix const qualifier warning in blkid_parse_tag_string
Karel Zak [Thu, 27 Nov 2025 15:28:41 +0000 (16:28 +0100)] 
libblkid: fix const qualifier warning in blkid_parse_tag_string

Fix const qualifier discarded warning in blkid_parse_tag_string().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strchr() function returns a pointer into a const string, so
introduce a separate 'eq' variable to hold this const pointer for
finding the '=' separator. Also move the 'cp' variable declaration
into the block where it's actually used for quote handling.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: fix const qualifier warning in mnt_parse_mountinfo_line
Karel Zak [Thu, 27 Nov 2025 15:24:11 +0000 (16:24 +0100)] 
libmount: fix const qualifier warning in mnt_parse_mountinfo_line

Fix const qualifier discarded warning in mnt_parse_mountinfo_line().
This warning is reported by gcc 15 which defaults to the C23 standard.

The strstr() function returns a pointer into a const string, so
introduce a separate 'sep' variable to hold this const pointer,
keeping 'p' for non-const unmangle() results that need to be freed.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: fix const qualifier warnings for C23
Karel Zak [Thu, 27 Nov 2025 14:45:55 +0000 (15:45 +0100)] 
libmount: fix const qualifier warnings for C23

Fix const qualifier discarded warnings in optlist_add_flags(),
mnt_opt_value_with(), and mnt_optstr_apply_flags() functions.
These warnings are reported by gcc 15 which defaults to the C23 standard.

The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolsns: fix const qualifier warnings for C23
Karel Zak [Thu, 27 Nov 2025 14:41:21 +0000 (15:41 +0100)] 
lsns: fix const qualifier warnings for C23

Fix const qualifier discarded warnings in read_persistent_namespaces()
and is_path_included() functions. These warnings are reported by gcc 15
which defaults to the C23 standard.

The strchr() and strstr() functions return pointers into const strings,
so the receiving variables must be declared as const char *.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'PR/build-bsearch-const' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 27 Nov 2025 11:40:16 +0000 (12:40 +0100)] 
Merge branch 'PR/build-bsearch-const' of https://github.com/karelzak/util-linux-work

* 'PR/build-bsearch-const' of https://github.com/karelzak/util-linux-work:
  lib, lscpu: fix const qualifier discarded warnings in bsearch

2 weeks agoMerge branch 'lsfd--tun-netns' of https://github.com/masatake/util-linux
Karel Zak [Thu, 27 Nov 2025 09:32:15 +0000 (10:32 +0100)] 
Merge branch 'lsfd--tun-netns' of https://github.com/masatake/util-linux

* 'lsfd--tun-netns' of https://github.com/masatake/util-linux:
  lsfd: add TUN.DEVNETNS column
  tests: (lsfd::mkfds-cdev-tun,refactor) make the case extensible
  lsfd: (doc) fix English in SOCK.NETNS description
  lsfd: (cleanup) add missing "break" in a case statement
  lsfd: (cleanup) return 0 instead of false
  lsfd: (refactor) introduce tundata struct

2 weeks agoMerge branch 'drop-const' of https://github.com/DaanDeMeyer/util-linux
Karel Zak [Thu, 27 Nov 2025 09:30:59 +0000 (10:30 +0100)] 
Merge branch 'drop-const' of https://github.com/DaanDeMeyer/util-linux

* 'drop-const' of https://github.com/DaanDeMeyer/util-linux:
  blkid: Drop const from blkid_partitions_get_name()

2 weeks agolib, lscpu: fix const qualifier discarded warnings in bsearch
Karel Zak [Thu, 27 Nov 2025 09:27:07 +0000 (10:27 +0100)] 
lib, lscpu: fix const qualifier discarded warnings in bsearch

Fix compilation warnings from newer compilers with stricter
const-correctness checks. When bsearch() searches in const arrays,
the result pointer must also be const to avoid discarding the
const qualifier.

Fixed in:
- lib/color-names.c: searching in static const basic_schemes[]
- sys-utils/lscpu-cputype.c: searching in const pattern arrays

The warnings were:
  lib/color-names.c:62:13: error: assignment discards 'const'
  qualifier from pointer target type
  [-Werror=discarded-qualifiers]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'docs--how-contribute' of https://github.com/masatake/util-linux
Karel Zak [Thu, 27 Nov 2025 09:10:37 +0000 (10:10 +0100)] 
Merge branch 'docs--how-contribute' of https://github.com/masatake/util-linux

* 'docs--how-contribute' of https://github.com/masatake/util-linux:
  docs: write about EditorConfig

2 weeks agoblkid: Drop const from blkid_partitions_get_name()
Daan De Meyer [Wed, 26 Nov 2025 14:08:25 +0000 (15:08 +0100)] 
blkid: Drop const from blkid_partitions_get_name()

const for idx is useless as the value is copied anyway, so drop the
const. AFAIK this doesn't change ABI.

2 weeks agoMerge branch 'fix/inconsistent_bash_completions' of https://github.com/cgoesche/util...
Karel Zak [Wed, 26 Nov 2025 10:46:55 +0000 (11:46 +0100)] 
Merge branch 'fix/inconsistent_bash_completions' of https://github.com/cgoesche/util-linux-fork

* 'fix/inconsistent_bash_completions' of https://github.com/cgoesche/util-linux-fork:
  bash-completion: (unshare) add missing --map-subids option
  tunelp: remove extraneous -T option
  partx: mark the --list option as deprecated
  namei: reestablish --nosymlinks option's functionality
  bash-completion: (mountpoint) add missing --show option
  bash-completion: (mount) add missing --ro option
  mount: document --ro option on the man page
  mount: add missing --ro option info in usage message
  bash-completion: (lslogins) add missing long options
  lslogins: fix incomplete option info in usage message
  lsclocks: add missing --no-discover-rtc option info in usage message
  bash-completion: (lsclocks) add missing --no-discover-rtc option
  bash-completion: (hwclock) add missing --ul-debug option
  bash-completion: (flock) add missing long options
  flock: fix incomplete -n option info in usage message

2 weeks agoMerge branch 'array_size_countof' of https://github.com/crrodriguez/util-linux
Karel Zak [Wed, 26 Nov 2025 10:26:13 +0000 (11:26 +0100)] 
Merge branch 'array_size_countof' of https://github.com/crrodriguez/util-linux

* 'array_size_countof' of https://github.com/crrodriguez/util-linux:
  include: implement ARRAY_SIZE with compiler _Countof if supported

2 weeks agodocs: write about EditorConfig
Masatake YAMATO [Wed, 26 Nov 2025 08:36:53 +0000 (17:36 +0900)] 
docs: write about EditorConfig

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2 weeks agoinclude: implement ARRAY_SIZE with compiler _Countof if supported
Cristian Rodríguez [Mon, 24 Nov 2025 20:04:08 +0000 (17:04 -0300)] 
include: implement ARRAY_SIZE with compiler _Countof if supported

C2Y has _Countof operator for this.
GCC has an stdcountof.h hedaer and a countof definition
Clang implements _Countof and needs __has_extension check

2 weeks agobash-completion: (unshare) add missing --map-subids option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 04:32:11 +0000 (23:32 -0500)] 
bash-completion: (unshare) add missing --map-subids option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agotunelp: remove extraneous -T option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 04:30:15 +0000 (23:30 -0500)] 
tunelp: remove extraneous -T option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agopartx: mark the --list option as deprecated
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 04:19:56 +0000 (23:19 -0500)] 
partx: mark the --list option as deprecated

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agonamei: reestablish --nosymlinks option's functionality
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 04:04:55 +0000 (23:04 -0500)] 
namei: reestablish --nosymlinks option's functionality

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (mountpoint) add missing --show option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 04:01:30 +0000 (23:01 -0500)] 
bash-completion: (mountpoint) add missing --show option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (mount) add missing --ro option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:59:31 +0000 (22:59 -0500)] 
bash-completion: (mount) add missing --ro option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agomount: document --ro option on the man page
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:58:35 +0000 (22:58 -0500)] 
mount: document --ro option on the man page

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agomount: add missing --ro option info in usage message
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:57:35 +0000 (22:57 -0500)] 
mount: add missing --ro option info in usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (lslogins) add missing long options
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:53:31 +0000 (22:53 -0500)] 
bash-completion: (lslogins) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agolslogins: fix incomplete option info in usage message
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:51:34 +0000 (22:51 -0500)] 
lslogins: fix incomplete option info in usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agolsclocks: add missing --no-discover-rtc option info in usage message
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:41:07 +0000 (22:41 -0500)] 
lsclocks: add missing --no-discover-rtc option info in usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (lsclocks) add missing --no-discover-rtc option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:40:26 +0000 (22:40 -0500)] 
bash-completion: (lsclocks) add missing --no-discover-rtc option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (hwclock) add missing --ul-debug option
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:35:09 +0000 (22:35 -0500)] 
bash-completion: (hwclock) add missing --ul-debug option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agobash-completion: (flock) add missing long options
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:31:00 +0000 (22:31 -0500)] 
bash-completion: (flock) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2 weeks agoflock: fix incomplete -n option info in usage message
Christian Goeschel Ndjomouo [Mon, 24 Nov 2025 03:29:01 +0000 (22:29 -0500)] 
flock: fix incomplete -n option info in usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 weeks agolsfd: add TUN.DEVNETNS column
Masatake YAMATO [Sun, 23 Nov 2025 07:18:48 +0000 (16:18 +0900)] 
lsfd: add TUN.DEVNETNS column

lsfd can show the name of the network device behind a file descriptor
pointing to a tun/tap device.

    # lsfd -Q 'SOURCE == "misc:tun"'
    COMMAND             PID       USER ASSOC  XMODE TYPE   SOURCE MNTID INODE NAME
    qemu-system-x86  846384       qemu    35 rw----  CHR misc:tun    36  1145 iface=vnet21
    pasta.avx2      1837933     yamato     8 rw---m  CHR misc:tun  2143  1145 iface=ens8191
    ...

This feature helps users inspect target processes, containers, and/or
VMs with tools such as tcpdump, wireshark, or ip-link.

However, I found a case where the device name was not sufficient.
pasta (https://passt.top/) provides networking for rootless
containers. It creates a tap device whose name matches the name of a
network device on the host:

    $ ip link show ens8191
    5: ens8191: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...

    $ ethtool -i ens8191 | head -1
    driver: atlantic

    $ podman exec 9fbbed215871 ip link show ens8191
    2: ens8191: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 ...

    $ podman exec 9fbbed215871 ethtool -i ens8191 | head -1
    driver: tun

A name alone is not enough to identify a network device on the system.

With this change, lsfd reports the network namespace to which the
tun/tap device belongs:

    # lsfd -Q 'SOURCE == "misc:tun"' -oCOMMAND,PID,SOURCE,TUN.DEVNETNS,NAME
    COMMAND             PID   SOURCE TUN.DEVNETNS NAME
    qemu-system-x86  846384 misc:tun   4026531840 iface=vnet21 devnetns=4026531840
    pasta.avx2      1837933 misc:tun   4026536354 iface=ens8191 devnetns=4026536354
    ...

This change relies on the TUNGETDEVNETNS ioctl added in:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c3e0e3bb623c3735b8c9ab8aa8332f944f83a9f

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agolsfd: fix bsearch macro usage with glibc C23
Cristian Rodríguez [Sat, 22 Nov 2025 13:41:08 +0000 (10:41 -0300)] 
lsfd: fix bsearch macro usage with glibc C23

C23 requires bsearch to be a const preserving macro, build now fails
with

../lsfd-cmd/lsfd.c:1879:75: error: macro ‘bsearch’ passed 6 arguments, but takes just 5
 1879 |                                     nfds, sizeof(struct pollfd), pollfdcmp))
      |                                                                           ^
In file included from ../include/c.h:17,
                 from ../lsfd-cmd/lsfd.c:48:
/usr/include/stdlib.h:987:10: note: macro ‘bsearch’ defined here
  987 | # define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR)                        \

  add parenthesis around expression to fix it.

3 weeks agotests: (lsfd::mkfds-cdev-tun,refactor) make the case extensible
Masatake YAMATO [Sun, 23 Nov 2025 07:00:24 +0000 (16:00 +0900)] 
tests: (lsfd::mkfds-cdev-tun,refactor) make the case extensible

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agolsfd: (doc) fix English in SOCK.NETNS description
Masatake YAMATO [Sun, 23 Nov 2025 08:43:40 +0000 (17:43 +0900)] 
lsfd: (doc) fix English in SOCK.NETNS description

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agolsfd: (cleanup) add missing "break" in a case statement
Masatake YAMATO [Sat, 22 Nov 2025 23:15:38 +0000 (08:15 +0900)] 
lsfd: (cleanup) add missing "break" in a case statement

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agolsfd: (cleanup) return 0 instead of false
Masatake YAMATO [Sat, 22 Nov 2025 23:14:42 +0000 (08:14 +0900)] 
lsfd: (cleanup) return 0 instead of false

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agolsfd: (refactor) introduce tundata struct
Masatake YAMATO [Sat, 22 Nov 2025 21:35:14 +0000 (06:35 +0900)] 
lsfd: (refactor) introduce tundata struct

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agoMerge branch 'PR/mountpoint-statmount' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 20 Nov 2025 12:34:23 +0000 (13:34 +0100)] 
Merge branch 'PR/mountpoint-statmount' of https://github.com/karelzak/util-linux-work

* 'PR/mountpoint-statmount' of https://github.com/karelzak/util-linux-work:
  mountpoint: use single libmount cache for all path resolutions
  mountpoint: add --show option to print mountpoint path
  mountpoint: use statmount() syscall on modern kernels

3 weeks agoMerge branch 'master-branch-4' of https://github.com/Leefancy/util-linux
Karel Zak [Thu, 20 Nov 2025 11:20:01 +0000 (12:20 +0100)] 
Merge branch 'master-branch-4' of https://github.com/Leefancy/util-linux

* 'master-branch-4' of https://github.com/Leefancy/util-linux:
  kill: the situation where fd is opened but not closed

3 weeks agomountpoint: use single libmount cache for all path resolutions
Karel Zak [Wed, 19 Nov 2025 12:46:40 +0000 (13:46 +0100)] 
mountpoint: use single libmount cache for all path resolutions

Move libmount cache initialization to main() and pass it through
the control structure. This allows the cache to be reused across
all mnt_resolve_path() calls, reducing allocations.

Also add cleanup section in main() with goto labels for proper
resource deallocation in a single location.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agomountpoint: add --show option to print mountpoint path
Karel Zak [Wed, 19 Nov 2025 12:32:25 +0000 (13:32 +0100)] 
mountpoint: add --show option to print mountpoint path

Add a new --show option that prints the actual mountpoint path for
a given directory or file. This is useful for:
- Resolving any path to its containing mountpoint
- Finding the canonical mountpoint path when symlinks are involved
- Determining the mountpoint from paths within filesystems

The option requires kernel support for statmount(2) (Linux 6.8+).
On older kernels without statmount support, the option fails with
an error message, as the /proc/self/mountinfo fallback cannot
resolve arbitrary paths to their containing mountpoint.

Example usage:
  $ mountpoint --show /
  /
  $ mountpoint --show /home/user/file.txt
  /home

The --show option always returns EXIT_SUCCESS (0) when it successfully
finds the mountpoint, regardless of whether the given path itself is
a mountpoint or not.

Addresses: https://github.com/util-linux/util-linux/issues/3806
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agomountpoint: use statmount() syscall on modern kernels
Karel Zak [Wed, 19 Nov 2025 12:01:02 +0000 (13:01 +0100)] 
mountpoint: use statmount() syscall on modern kernels

Improve mountpoint(1) to use the modern statmount() system call
(available since Linux 6.8) instead of parsing /proc/self/mountinfo.

- Works without /proc mounted on modern kernels
- More efficient than parsing /proc/self/mountinfo
- Better detection of bind mounts via statmount()
- Graceful fallback maintains compatibility

Addresses: https://github.com/util-linux/util-linux/issues/3806
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agokill: the situation where fd is opened but not closed
fortunate-lee [Wed, 19 Nov 2025 01:59:18 +0000 (09:59 +0800)] 
kill: the situation where fd is opened but not closed

Signed-off-by: fortunate-lee <lijian01@kylinos.cn>