]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 months agoMerge branch 'add_annotate_opt_lscpu' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 5 Jan 2026 11:34:58 +0000 (12:34 +0100)] 
Merge branch 'add_annotate_opt_lscpu' of https://github.com/cgoesche/util-linux-fork

* 'add_annotate_opt_lscpu' of https://github.com/cgoesche/util-linux-fork:
  lscpu: add --annotate info to man page
  bash-completion: (lscpu) add --annotate option
  lscpu: add column header annotations for -C and -e

3 months agoMerge branch 'fix_readprofile_mapfile_option' of https://github.com/cgoesche/util...
Karel Zak [Mon, 5 Jan 2026 11:32:13 +0000 (12:32 +0100)] 
Merge branch 'fix_readprofile_mapfile_option' of https://github.com/cgoesche/util-linux-fork

* 'fix_readprofile_mapfile_option' of https://github.com/cgoesche/util-linux-fork:
  readprofile: (manpage) fix incorrect file name in --mapfile description

3 months agoMerge branch 'lsfd--no-vsock-diag' of https://github.com/masatake/util-linux
Karel Zak [Mon, 5 Jan 2026 11:31:22 +0000 (12:31 +0100)] 
Merge branch 'lsfd--no-vsock-diag' of https://github.com/masatake/util-linux

* 'lsfd--no-vsock-diag' of https://github.com/masatake/util-linux:
  lsfd,test_mkfds: make linux/vm_sockets_diag.h optional

3 months agoMerge branch 'fix/check_long_opts_integrity_usage' of https://github.com/cgoesche...
Karel Zak [Mon, 5 Jan 2026 11:29:36 +0000 (12:29 +0100)] 
Merge branch 'fix/check_long_opts_integrity_usage' of https://github.com/cgoesche/util-linux-fork

* 'fix/check_long_opts_integrity_usage' of https://github.com/cgoesche/util-linux-fork:
  readprofile: fix memory leak related to boot_uname_r_str() in usage()
  lslogins: ignore special long options in CI CHECK
  setpriv: fix usage message inconsistency
  newgrp: provide --command info in output message
  logger: ignore libsystemd-dependent long opt in CI CHECK
  ci: add usage message consistency check to CI CHECK phase
  su-common: ignore runuser(1) specific long option in CI CHECK
  nologin: ignore well-known shell command-line options in CI CHECK
  unshare: fix inconsistency in usage message
  flock: resolve consistency issue in the usage message
  nsenter: ignore SELinux-specific long option in CI CHECK
  namei: ignore SELinux-specific long option in CI CHECK
  lsclocks: fix inconsistency in usage message
  hwclock: mark non-standard long options to ignore in CI CHECK
  tools: (get-options.sh) skip programs that do not use <struct option>
  tools: (get-options.sh) ignore long opt definitions marked with IGNORECHECK=yes
  tools: (checkusage.sh) verify the completeness of listed long options

3 months agoMerge branch 'PR/Benno-17Dec-25'
Karel Zak [Mon, 5 Jan 2026 10:19:52 +0000 (11:19 +0100)] 
Merge branch 'PR/Benno-17Dec-25'

# Conflicts:
# sys-utils/unshare.c

3 months agologin: Add UID to usage message
Tobias Stoeckmann [Sun, 4 Jan 2026 18:08:01 +0000 (19:08 +0100)] 
login: Add UID to usage message

The UID can be supplied instead of a username.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agologin-utils/login: Sync usage with manual page
Tobias Stoeckmann [Sun, 4 Jan 2026 17:39:32 +0000 (18:39 +0100)] 
login-utils/login: Sync usage with manual page

The -f option is described differently in usage and man page.
Use the usage version for better readability.

Also note in manual page that UID is allowed as argument.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agologin-utils: add UIDs to manual pages
Tobias Stoeckmann [Sun, 4 Jan 2026 14:27:04 +0000 (15:27 +0100)] 
login-utils: add UIDs to manual pages

Add information about UIDs as command line arguments to manual pages of
chfn, chsh, and su, since they accept them now.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agopwdutils: fix grammar in comments
Tobias Stoeckmann [Sun, 4 Jan 2026 17:20:58 +0000 (18:20 +0100)] 
pwdutils: fix grammar in comments

No functional change

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosetpwnam: use getline instead of fgets
Tobias Stoeckmann [Sun, 4 Jan 2026 15:30:07 +0000 (16:30 +0100)] 
setpwnam: use getline instead of fgets

Handling long lines takes already a lot of code and if a line starts
with a NUL character, an out of boundary read occurs.

Just use getline.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosetpwnam: only unlock when actually locked
Tobias Stoeckmann [Sun, 4 Jan 2026 15:28:39 +0000 (16:28 +0100)] 
setpwnam: only unlock when actually locked

If no lock is held, do not unlock. With glibc this is fine, but let's
not put too many expectations on library implementations.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosetpwnam: check if /etc/passwd was fully read
Tobias Stoeckmann [Sun, 4 Jan 2026 15:26:13 +0000 (16:26 +0100)] 
setpwnam: check if /etc/passwd was fully read

An error while reading the existing /etc/passwd should be properly
handled to avoid truncation due to a bad read.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agochsh: extend usage message
Tobias Stoeckmann [Sun, 4 Jan 2026 14:26:19 +0000 (15:26 +0100)] 
chsh: extend usage message

The chsh utility accepts UIDs like chfn does, too.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agobuild(deps): bump actions/cache from 4 to 5
dependabot[bot] [Thu, 1 Jan 2026 18:05:09 +0000 (18:05 +0000)] 
build(deps): bump actions/cache from 4 to 5

Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 months agobuild(deps): bump actions/upload-artifact from 5 to 6
dependabot[bot] [Thu, 1 Jan 2026 18:05:04 +0000 (18:05 +0000)] 
build(deps): bump actions/upload-artifact from 5 to 6

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 months agostyle: fix coding style issues
Christian Goeschel Ndjomouo [Thu, 1 Jan 2026 04:10:57 +0000 (23:10 -0500)] 
style: fix coding style issues

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agoreadprofile: fix memory leak related to boot_uname_r_str() in usage()
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 15:19:20 +0000 (10:19 -0500)] 
readprofile: fix memory leak related to boot_uname_r_str() in usage()

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agolslogins: ignore special long options in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 06:03:02 +0000 (01:03 -0500)] 
lslogins: ignore special long options in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agosetpriv: fix usage message inconsistency
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 05:57:09 +0000 (00:57 -0500)] 
setpriv: fix usage message inconsistency

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agonewgrp: provide --command info in output message
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 05:51:31 +0000 (00:51 -0500)] 
newgrp: provide --command info in output message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agologger: ignore libsystemd-dependent long opt in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 05:44:18 +0000 (00:44 -0500)] 
logger: ignore libsystemd-dependent long opt in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agoci: add usage message consistency check to CI CHECK phase
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 05:02:46 +0000 (00:02 -0500)] 
ci: add usage message consistency check to CI CHECK phase

Add 'make checkusage' to the GitHub CI CHECK phase.
This ensures that all program's usage messages list all
long options defined in their respective source code.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agosu-common: ignore runuser(1) specific long option in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 05:00:43 +0000 (00:00 -0500)] 
su-common: ignore runuser(1) specific long option in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agonologin: ignore well-known shell command-line options in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:54:22 +0000 (23:54 -0500)] 
nologin: ignore well-known shell command-line options in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agounshare: fix inconsistency in usage message
Christian Goeschel Ndjomouo [Sun, 21 Dec 2025 21:53:30 +0000 (16:53 -0500)] 
unshare: fix inconsistency in usage message

Closes: #3814
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotests: fdisk: add regression test for missing EBR gap between logical partitions
Martin Jungblut Schreiner [Mon, 29 Dec 2025 23:46:39 +0000 (20:46 -0300)] 
tests: fdisk: add regression test for missing EBR gap between logical partitions

Add a DOS/MBR test case where the first logical partition starts at 6145
(extended start 2048). In the regressed behaviour fdisk allows the next
logical partition to start at prev_end+1, which would place its EBR
(start - 2048) inside the previous logical partition.

The expected behaviour is to require the next starting sector to be at least
prev_end + 2048 + 1 (e.g. 790528 in the testcase).

Closes issue #3925.

3 months agolibfdisk: (dos) fix logical partition start
Martin Jungblut Schreiner [Mon, 29 Dec 2025 22:52:56 +0000 (19:52 -0300)] 
libfdisk: (dos) fix logical partition start

fdisk could accept adjacent logical partitions, causing the EBR for the new
logical partition to be written inside the previous partition’s data area.
This can corrupt the EBR chain.

Fix free-sector search to keep an EBR gap (first_lba) after logical partitions.

3 months agoreadprofile: (manpage) fix incorrect file name in --mapfile description
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 16:13:30 +0000 (11:13 -0500)] 
readprofile: (manpage) fix incorrect file name in --mapfile description

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotests: correct UUID timestamp test expectations
Kiran Rangoon [Mon, 29 Dec 2025 03:51:00 +0000 (22:51 -0500)] 
tests: correct UUID timestamp test expectations

Update expected timestamps for additional test UUIDs to match actual
output. These test cases provide coverage for various timestamp ranges
including pre-epoch, historical, and far-future dates.

Signed-off-by: Kiran Rangoon <kiranrangoon0@gmail.com>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibuuid: fix timestamp overflow for pre-1970 dates
Kiran Rangoon [Mon, 29 Dec 2025 03:50:59 +0000 (22:50 -0500)] 
libuuid: fix timestamp overflow for pre-1970 dates

Use int64_t arithmetic to correctly handle timestamps before Unix epoch.
This fixes the overflow that was causing UUID timestamps from 1582 to
appear as far-future dates. Update test expectations accordingly.

Signed-off-by: Kiran Rangoon <kiranrangoon0@gmail.com>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibuuid: refactor gregorian_to_unix to populate timeval directly
Kiran Rangoon [Mon, 29 Dec 2025 03:50:58 +0000 (22:50 -0500)] 
libuuid: refactor gregorian_to_unix to populate timeval directly

Change function signature to take struct timeval pointer and populate
it directly, eliminating duplicate conversion code in callers.

Signed-off-by: Kiran Rangoon <kiranrangoon0@gmail.com>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibuuid: simplify gregorian-to-unix offset calculation
Kiran Rangoon [Mon, 29 Dec 2025 03:50:57 +0000 (22:50 -0500)] 
libuuid: simplify gregorian-to-unix offset calculation

Replace complex bit-shift offset calculation with a simple constant
definition for better readability and maintainability.

Signed-off-by: Kiran Rangoon <kiranrangoon0@gmail.com>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agotests: (lslocks) test -Q,--filter option
Masatake YAMATO [Sun, 14 Dec 2025 09:53:57 +0000 (18:53 +0900)] 
tests: (lslocks) test -Q,--filter option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agotests: (test_mkfds::nop) new factory just printing pid
Masatake YAMATO [Sun, 14 Dec 2025 09:51:32 +0000 (18:51 +0900)] 
tests: (test_mkfds::nop) new factory just printing pid

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: special-case PID for filtering (skip −1)
Masatake YAMATO [Mon, 29 Dec 2025 07:22:24 +0000 (16:22 +0900)] 
lslocks: special-case PID for filtering (skip −1)

The PID column may be printed as −1 for locks that are not tied to a
process or are inaccessible to lslocks (e.g., permission constraints).
The libsmartcols filter engine does not support negative integers, so
PID = −1 cannot be compared reliably.

Attach the PID as cell userdata only when PID >= 0, and use that value
for filter evaluation. Rows with PID = −1 are thus excluded from PID
comparisons.

No change to printed output.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: make SIZE filterable by normalizing to bytes
Masatake YAMATO [Mon, 15 Dec 2025 21:41:59 +0000 (06:41 +0900)] 
lslocks: make SIZE filterable by normalizing to bytes

The SIZE column may be printed in raw bytes or human-readable
units (KB/MB, etc.), which makes number-based comparison impossible.

Normalize SIZE to a byte value and store it in the cell via
libsmartcols `scols_cell_set_userdata`. When evaluating filter
expressions, use the stored byte value instead of the printed SIZE.

This enables consistent numeric comparisons (e.g., -Q 'SIZE > 1M')
regardless of the output format.

No change to printed output.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: implement Q, --filter option
Masatake YAMATO [Wed, 10 Dec 2025 14:35:10 +0000 (23:35 +0900)] 
lslocks: implement Q, --filter option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: factor out code getting and setting the data from add_scols_line
Masatake YAMATO [Wed, 10 Dec 2025 13:36:05 +0000 (22:36 +0900)] 
lslocks: factor out code getting and setting the data from add_scols_line

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) move proc_locks to struct lslocks
Masatake YAMATO [Fri, 19 Dec 2025 19:18:14 +0000 (04:18 +0900)] 
lslocks: (refactor) move proc_locks to struct lslocks

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) move pid_locks in main to struct lslocks
Masatake YAMATO [Fri, 19 Dec 2025 18:45:28 +0000 (03:45 +0900)] 
lslocks: (refactor) move pid_locks in main to struct lslocks

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) move "tab" file static variable to struct lslocks
Masatake YAMATO [Fri, 19 Dec 2025 16:46:43 +0000 (01:46 +0900)] 
lslocks: (refactor) move "tab" file static variable to struct lslocks

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) add struct lslocks representing the global context
Masatake YAMATO [Fri, 19 Dec 2025 16:29:43 +0000 (01:29 +0900)] 
lslocks: (refactor) add struct lslocks representing the global context

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) use global bytes in get_json_type_for_column()
Masatake YAMATO [Mon, 15 Dec 2025 20:15:30 +0000 (05:15 +0900)] 
lslocks: (refactor) use global bytes in get_json_type_for_column()

`get_json_type_for_column()` used to take `representing_in_bytes`, but
every caller passed the global `bytes`. The parameter added no value
and split the ownership of the setting. Drop the parameter and read
the global `bytes` instead.

This aligns lslocks with lsblk and prepares for adding `-Q/--filter`.
lsblk also reads global `bytes` defined in lsblk.c

No functional change intended.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolsfd,test_mkfds: make linux/vm_sockets_diag.h optional
Masatake YAMATO [Wed, 24 Dec 2025 21:54:13 +0000 (06:54 +0900)] 
lsfd,test_mkfds: make linux/vm_sockets_diag.h optional

Older kernels (at least 3.10 used by CentOS/RH/OEL 7.9) do not have
linux/vm_sockets_diag.h yet.

Closes: https://github.com/util-linux/util-linux/issues/3916
Co-Author: Fabian Groffen <grobian@bitzolder.nl>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolscpu: add --annotate info to man page
Christian Goeschel Ndjomouo [Fri, 26 Dec 2025 21:32:16 +0000 (16:32 -0500)] 
lscpu: add --annotate info to man page

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agobash-completion: (lscpu) add --annotate option
Christian Goeschel Ndjomouo [Fri, 26 Dec 2025 21:29:44 +0000 (16:29 -0500)] 
bash-completion: (lscpu) add --annotate option

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agorfkill: Output in JSON format if -J is provided.
Xing Guo [Fri, 26 Dec 2025 12:25:54 +0000 (20:25 +0800)] 
rfkill: Output in JSON format if -J is provided.

This patch teaches rfkill output in JSON format if -J is provided.

E.g.,

```
$ ./rfkill -J list
{
   "rfkilldevices": [
      {
         "id": 0,
         "type": "bluetooth",
         "device": "tpacpi_bluetooth_sw",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 1,
         "type": "wwan",
         "device": "tpacpi_wwan_sw",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 3,
         "type": "wlan",
         "device": "phy0",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 4,
         "type": "bluetooth",
         "device": "hci0",
         "soft": "unblocked",
         "hard": "unblocked"
      }
   ]
}

$ ./rfkill -J list bluetooth
{
   "rfkilldevices": [
      {
         "id": 0,
         "type": "bluetooth",
         "device": "tpacpi_bluetooth_sw",
         "soft": "unblocked",
         "hard": "unblocked"
      },{
         "id": 4,
         "type": "bluetooth",
         "device": "hci0",
         "soft": "unblocked",
         "hard": "unblocked"
      }
   ]
}
```

3 months agolscpu: add column header annotations for -C and -e
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 22:44:21 +0000 (17:44 -0500)] 
lscpu: add column header annotations for -C and -e

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agoflock: resolve consistency issue in the usage message
Christian Goeschel Ndjomouo [Sun, 21 Dec 2025 21:38:26 +0000 (16:38 -0500)] 
flock: resolve consistency issue in the usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agonsenter: ignore SELinux-specific long option in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:46:05 +0000 (23:46 -0500)] 
nsenter: ignore SELinux-specific long option in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agonamei: ignore SELinux-specific long option in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:45:20 +0000 (23:45 -0500)] 
namei: ignore SELinux-specific long option in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agolsclocks: fix inconsistency in usage message
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:43:18 +0000 (23:43 -0500)] 
lsclocks: fix inconsistency in usage message

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agohwclock: mark non-standard long options to ignore in CI CHECK
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:32:43 +0000 (23:32 -0500)] 
hwclock: mark non-standard long options to ignore in CI CHECK

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotools: (get-options.sh) skip programs that do not use <struct option>
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 04:31:02 +0000 (23:31 -0500)] 
tools: (get-options.sh) skip programs that do not use <struct option>

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotools: (get-options.sh) ignore long opt definitions marked with IGNORECHECK=yes
Christian Goeschel Ndjomouo [Thu, 25 Dec 2025 03:54:29 +0000 (22:54 -0500)] 
tools: (get-options.sh) ignore long opt definitions marked with IGNORECHECK=yes

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotools: (checkusage.sh) verify the completeness of listed long options
Christian Goeschel Ndjomouo [Sun, 21 Dec 2025 20:07:10 +0000 (15:07 -0500)] 
tools: (checkusage.sh) verify the completeness of listed long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agolslocks: (refactor) add a helper function refining value returned from get_lock
Masatake YAMATO [Fri, 19 Dec 2025 18:19:42 +0000 (03:19 +0900)] 
lslocks: (refactor) add a helper function refining value returned from get_lock

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) don't use redundant callback functions
Masatake YAMATO [Fri, 19 Dec 2025 17:39:38 +0000 (02:39 +0900)] 
lslocks: (refactor) don't use redundant callback functions

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) specify list_head as type instead of abusing void*
Masatake YAMATO [Tue, 9 Dec 2025 22:11:39 +0000 (07:11 +0900)] 
lslocks: (refactor) specify list_head as type instead of abusing void*

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) use separate function to initialize libscols_table
Masatake YAMATO [Tue, 9 Dec 2025 22:31:59 +0000 (07:31 +0900)] 
lslocks: (refactor) use separate function to initialize libscols_table

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) remove an unused local variable
Masatake YAMATO [Tue, 9 Dec 2025 22:21:38 +0000 (07:21 +0900)] 
lslocks: (refactor) remove an unused local variable

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (refactor) use narrow variable scoping for loop counters
Masatake YAMATO [Tue, 9 Dec 2025 22:20:08 +0000 (07:20 +0900)] 
lslocks: (refactor) use narrow variable scoping for loop counters

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agolslocks: (comment) fix grammar
Masatake YAMATO [Fri, 19 Dec 2025 19:04:59 +0000 (04:04 +0900)] 
lslocks: (comment) fix grammar

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agozramctl: Add note about column descriptions
Karel Zak [Wed, 17 Dec 2025 12:10:13 +0000 (13:10 +0100)] 
zramctl: Add note about column descriptions

Addresses: https://github.com/util-linux/util-linux/issues/3903
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'unshare/userowner' of https://github.com/arachsys-prs/util-linux
Karel Zak [Wed, 17 Dec 2025 11:47:16 +0000 (12:47 +0100)] 
Merge branch 'unshare/userowner' of https://github.com/arachsys-prs/util-linux

* 'unshare/userowner' of https://github.com/arachsys-prs/util-linux:
  unshare: add --owner to set user namespace owner uid and gid

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'unshare/userbind' of https://github.com/arachsys-prs/util-linux
Karel Zak [Wed, 17 Dec 2025 11:08:19 +0000 (12:08 +0100)] 
Merge branch 'unshare/userbind' of https://github.com/arachsys-prs/util-linux

* 'unshare/userbind' of https://github.com/arachsys-prs/util-linux:
  unshare: fix user namespace bind mounts
  unshare: remove get_mnt_ino() check in bind_ns_files_from_child()

3 months agoMerge branch 'lsns-8--fix-missing-comma' of https://github.com/masatake/util-linux
Karel Zak [Wed, 17 Dec 2025 11:07:00 +0000 (12:07 +0100)] 
Merge branch 'lsns-8--fix-missing-comma' of https://github.com/masatake/util-linux

* 'lsns-8--fix-missing-comma' of https://github.com/masatake/util-linux:
  docs: lsns(8): add missing a comma in SEE ALSO section

3 months agoMerge branch 'feat/su_accept_gid_args' of https://github.com/cgoesche/util-linux...
Karel Zak [Wed, 17 Dec 2025 11:06:35 +0000 (12:06 +0100)] 
Merge branch 'feat/su_accept_gid_args' of https://github.com/cgoesche/util-linux-fork

* 'feat/su_accept_gid_args' of https://github.com/cgoesche/util-linux-fork:
  unshare: use MAX_OF_UINT_TYPE instead of (type)-1
  chfn: enable the use of the username or UID
  unshare: use the new ul_get{grp,userpw}_str() routines
  login: use new xgetuserpw() instead of xgetpwnam()
  chsh: use new xgetuserpw() instead of xgetpwnam()
  su: accept group name and GID in -g and -G options
  tests: (su) test GID argument in --group option
  lib: (pwdutils.c) new library routines to get a group/passwd struct by name or GID/UID
  include/c.h: add MAX_OF_UINT_TYPE macro to get max num of an uint type

3 months agotreewide: consistently use tabs for indentation where it is the rule
Benno Schulenberg [Tue, 9 Dec 2025 15:02:22 +0000 (16:02 +0100)] 
treewide: consistently use tabs for indentation where it is the rule

Also unwrap a line, delete two blank lines, and improve three comments.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agochmem: do not word a configuration failure as an instruction to the user
Benno Schulenberg [Tue, 9 Dec 2025 15:02:21 +0000 (16:02 +0100)] 
chmem: do not word a configuration failure as an instruction to the user

When the current machine does not support configuring/deconfiguring
memory, simply report that it cannot be done, instead of seemingly
telling the user to skip the configuring/deconfiguring.

Also, there is no need to mention `chmem` in the message: mentioning
just the recommended option (-e or -d) is enough.  Also, consistently
terminate all four messages with a period.

This improves upon commit ab2e709600 ("chmem: improve messages").

CC: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolosetup: snip --verbose from bash-completion, and 'v' from options string
Benno Schulenberg [Tue, 9 Dec 2025 15:02:20 +0000 (16:02 +0100)] 
losetup: snip --verbose from bash-completion, and 'v' from options string

This should have been part of commit 7e27c81597 from two months ago.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agounshare: fix user namespace bind mounts
Chris Webb [Mon, 15 Dec 2025 18:48:29 +0000 (18:48 +0000)] 
unshare: fix user namespace bind mounts

unshare --user=<file> always fails because we no longer have CAP_SYS_ADMIN
in the parent user namespace after unsharing to create the new one. As with
unshare --mount=<file>, fork a child to make the bind mount instead.

Signed-off-by: Chris Webb <chris@arachsys.com>
3 months agounshare: remove get_mnt_ino() check in bind_ns_files_from_child()
Chris Webb [Mon, 15 Dec 2025 18:41:08 +0000 (18:41 +0000)] 
unshare: remove get_mnt_ino() check in bind_ns_files_from_child()

get_mnt_ino() was originally introduced in c84f2590 where it was used
in a loop to wait for the parent process to unshare the mount namespace
before binding the namespace in its child.

The parent and child processes are now synchronised with eventfd, so
remove this vestigial check and the now-unused get_mnt_ino() function.
This allows bind_ns_files_from_child() to be used even when the mount
namespace isn't amongst the namespaces being unshared.

Signed-off-by: Chris Webb <chris@arachsys.com>
3 months agounshare: add --owner to set user namespace owner uid and gid
Chris Webb [Sun, 14 Dec 2025 23:18:33 +0000 (23:18 +0000)] 
unshare: add --owner to set user namespace owner uid and gid

As well as the mappings between lower and upper ids, a user namespace is
associated with an owner user and group in its parent. These are set from
the uid and gid when the unshare() call is made, and determine which user
in the parent namespace has CAP_SYS_ADMIN in the child and can setns()
into it.

Add an --owner=<uid>:<gid> option which allows a privileged user to
create a user namespace on behalf of another user, mapping parent ids
and/or bind-mounting the namespace with privileges that the new owner
would not have.

Simplify the control flow around map_ids_from_child() vs mapping them
inline to avoid too many special cases. We reset mapuser and mapgroup to
-1 to signal that the mapping has been delegated to the child helper.

For completeness, we maintain the semantics of --map-root-user and
--map-current-user, binding the invoking user to root or itself in the
new namespace. However, when --owner is used, these must be handled by
a forked child as with --map-users and --map-groups.

Signed-off-by: Chris Webb <chris@arachsys.com>
3 months agotests: convert fallocate to use subtests
Karel Zak [Thu, 11 Dec 2025 12:42:02 +0000 (13:42 +0100)] 
tests: convert fallocate to use subtests

Convert the fallocate test to use subtests pattern following the
waitpid test example. This allows testing multiple scenarios in a
single test run.

Subtests:
- alloc: Basic allocation test (original test)
- report-data-holes: Report holes before digging (data holes)
- dig-holes: Convert data holes to sparse holes with verbose output
- report-file-holes: Report holes after digging (file holes)

The test reuses the same image file across dig/report subtests to
efficiently test the complete workflow: report → dig → report.

Uses <testfile> placeholder instead of absolute paths in expected
output to ensure tests work from any directory.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agofallocate: refactor --report-holes and --dig-holes output
Karel Zak [Thu, 11 Dec 2025 12:39:40 +0000 (13:39 +0100)] 
fallocate: refactor --report-holes and --dig-holes output

This commit consolidates duplicate printf() calls and calculations by
introducing two new helper functions:

- update_holestat(): Tracks hole statistics and prints verbose output
  for both HOLETYPE_FILE and HOLETYPE_DATA. Statistics are always
  collected regardless of report mode.

- summary_holestat(): Prints summary output for file holes, data holes,
  and "converted to sparse holes" message. Uses consistent formatting
  with hole counts and percentages.

Changes:
- Made 'report' a global variable (like 'verbose')
- Renamed struct holes_report to struct holestat for consistency
- Changed struct fields to uintmax_t to eliminate casts in printf
- Removed 'report' parameter from dig_holes() function
- Unified dig and report modes to use single dig_holes() call
- All output strings wrapped in _() for translation
- Consistent printf() usage instead of mixed fprintf()
- Percentage format: "(%ju bytes, %.2f%% of the file)"

The refactoring eliminates ~40 lines of duplicate code while maintaining
all functionality and improving code maintainability.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoFix memory leak in setpwnam()
yao zhang [Thu, 11 Dec 2025 11:20:58 +0000 (19:20 +0800)] 
Fix memory leak in setpwnam()

Add memeory release for tmpname upon successful return.

3 months agodocs: lsns(8): add missing a comma in SEE ALSO section
Masatake YAMATO [Wed, 10 Dec 2025 22:51:25 +0000 (07:51 +0900)] 
docs: lsns(8): add missing a comma in SEE ALSO section

3 months agofallocate: add --report-holes
syokensyo [Wed, 10 Dec 2025 11:53:23 +0000 (12:53 +0100)] 
fallocate: add --report-holes

[kzak@redhat.com: - cleanup commit message, rebase]

Fixes: #3822
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolib: (pidfd-utils.c) set __unused__ in right way
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>
3 months 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

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

4 months 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()

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