]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
4 hours agoMerge branch 'fix/missing_long_opts_completions' of https://github.com/cgoesche/util... master
Karel Zak [Fri, 7 Nov 2025 11:33:56 +0000 (12:33 +0100)] 
Merge branch 'fix/missing_long_opts_completions' of https://github.com/cgoesche/util-linux-fork

* 'fix/missing_long_opts_completions' of https://github.com/cgoesche/util-linux-fork: (41 commits)
  bash-completion: (nsenter) add missing --follow-context
  bash-completion: (namei) add missing --context
  bash-completion: (setpriv) add missing long options
  bash-completion: (pg) add missing long options
  bash-completion: (lastlog2) add missing --active
  bash-completion: (whereis) add missing long options
  bash-completion: (wdctl) add missing long options
  bash-completion: (uuidd) add missing --cont-clock
  bash-completion: (unshare) add missing long options
  bash-completion: (swapon) add missing --options
  bash-completion: (sfdisk) add missing long options
  bash-completion: (setsid) add missing --fork
  bash-completion: (scriptlive) add missing --echo
  bash-completion: (renice) add missing --relative
  bash-completion: (more) add missing --exit-on-eof
  bash-completion: (mkswap) add missing long options
  bash-completion: (mkfs.minix) add missing --lock
  bash-completion: (mkfs.cramfs) add missing long options
  bash-completion: (mkfs.bfs) add missing --lock
  bash-completion: (lsmem) add missing --split
  ...

5 hours agoMerge branch 'PR/benno-losetup' of https://github.com/karelzak/util-linux-work
Karel Zak [Fri, 7 Nov 2025 11:19:16 +0000 (12:19 +0100)] 
Merge branch 'PR/benno-losetup' of https://github.com/karelzak/util-linux-work

* 'PR/benno-losetup' of https://github.com/karelzak/util-linux-work:
  losetup: (man) put the synopses in a better order, the name-giver first
  losetup: remove the --verbose flag, as it doesn't actually do anything
  losetup: sort 'O' correctly for the mutual-exclusive check to work

5 hours agoMerge branch 'PR/include-optutils-err' of https://github.com/karelzak/util-linux...
Karel Zak [Fri, 7 Nov 2025 11:18:50 +0000 (12:18 +0100)] 
Merge branch 'PR/include-optutils-err' of https://github.com/karelzak/util-linux-work

* 'PR/include-optutils-err' of https://github.com/karelzak/util-linux-work:
  include/optutils: improve err_exclusive_options() output

5 hours agologin: add line break after timeout message
Karel Zak [Fri, 7 Nov 2025 10:57:58 +0000 (11:57 +0100)] 
login: add line break after timeout message

Just to make login(1) more user-friendly for those who do crazy things.

Based on https://github.com/util-linux/util-linux/pull/3842

Signed-off-by: Karel Zak <kzak@redhat.com>
6 hours agoinclude/optutils: improve err_exclusive_options() output
Karel Zak [Mon, 3 Nov 2025 12:41:31 +0000 (13:41 +0100)] 
include/optutils: improve err_exclusive_options() output

OLD:
$ losetup --remove --detach loop0
losetup: mutually exclusive arguments: --detach-all --all --set-capacity --detach --find --associated --remove
NEW:
$ losetup --remove --detach loop0
losetup: options --detach and --remove cannot be combined.

Suggested-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agolosetup: (man) put the synopses in a better order, the name-giver first
Benno Schulenberg [Wed, 29 Oct 2025 11:03:58 +0000 (12:03 +0100)] 
losetup: (man) put the synopses in a better order, the name-giver first

Also, condense the synopsis for setting up a loop device to just the
essentials -- it had become so long that it was incomprehensible.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 days agolosetup: remove the --verbose flag, as it doesn't actually do anything
Benno Schulenberg [Wed, 29 Oct 2025 11:03:57 +0000 (12:03 +0100)] 
losetup: remove the --verbose flag, as it doesn't actually do anything

Fourteen years ago, commit c7e0925def rewrote the `losetup` tool,
removing all references to the 'verbose' variable.  Three years
later, commit 60cb2c3720 removed the line 'verbose = 1' because
the compiler complained that the variable was set but never used.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 days agolosetup: sort 'O' correctly for the mutual-exclusive check to work
Benno Schulenberg [Wed, 29 Oct 2025 11:03:56 +0000 (12:03 +0100)] 
losetup: sort 'O' correctly for the mutual-exclusive check to work

The options need to be in strict ascending order.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 days agowdctl: remove -d option leftover
Munehisa Kamata [Tue, 28 Oct 2025 19:54:17 +0000 (12:54 -0700)] 
wdctl: remove -d option leftover

-d option was removed in commit f56338b43973 ("wdctl: allow to specify more
than one device"), but the optstring wasn't updated at that time and wdctl
can still accept the option halfway as below:

 $ wdctl -d
 wdctl: option requires an argument -- 'd'

whereas it should say:

 wdctl: invalid option -- 'd'

So update the optstring.

Fixes: f56338b43973 ("wdctl: allow to specify more than one device")
Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
4 days agoMerge branch 'fix/login_manpage_grammar' of https://github.com/cgoesche/util-linux...
Karel Zak [Mon, 3 Nov 2025 11:16:23 +0000 (12:16 +0100)] 
Merge branch 'fix/login_manpage_grammar' of https://github.com/cgoesche/util-linux-fork

* 'fix/login_manpage_grammar' of https://github.com/cgoesche/util-linux-fork:
  login: fix minor grammar mistake in the manpage

4 days agoMerge branch 'meson' of https://github.com/neheb/util-linux
Karel Zak [Mon, 3 Nov 2025 11:16:08 +0000 (12:16 +0100)] 
Merge branch 'meson' of https://github.com/neheb/util-linux

* 'meson' of https://github.com/neheb/util-linux:
  meson: fix non threaded toolchains

4 days agoMerge branch 'bst/hwclock-cmp-set' of https://github.com/Bastian-Krause/util-linux
Karel Zak [Mon, 3 Nov 2025 11:13:26 +0000 (12:13 +0100)] 
Merge branch 'bst/hwclock-cmp-set' of https://github.com/Bastian-Krause/util-linux

* 'bst/hwclock-cmp-set' of https://github.com/Bastian-Krause/util-linux:
  hwclock: skip RTC_PARAM_SET for --param-set with unchanged value

4 days agologin: fix minor grammar mistake in the manpage
cgoesche [Mon, 3 Nov 2025 03:31:40 +0000 (22:31 -0500)] 
login: fix minor grammar mistake in the manpage

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
4 days agomeson: fix non threaded toolchains
Rosen Penev [Sun, 2 Nov 2025 20:25:26 +0000 (12:25 -0800)] 
meson: fix non threaded toolchains

threads needs to be set as not required.

Cleaned up meson build slightly to use one dependency call.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
5 days agobash-completion: (nsenter) add missing --follow-context
cgoesche [Sat, 1 Nov 2025 23:50:17 +0000 (19:50 -0400)] 
bash-completion: (nsenter) add missing --follow-context

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
5 days agobash-completion: (namei) add missing --context
cgoesche [Sat, 1 Nov 2025 23:49:33 +0000 (19:49 -0400)] 
bash-completion: (namei) add missing --context

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
5 days agobash-completion: (setpriv) add missing long options
cgoesche [Sat, 1 Nov 2025 23:47:03 +0000 (19:47 -0400)] 
bash-completion: (setpriv) add missing long options

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
5 days agobash-completion: (pg) add missing long options
cgoesche [Sat, 1 Nov 2025 23:46:27 +0000 (19:46 -0400)] 
bash-completion: (pg) add missing long options

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
5 days agobash-completion: (lastlog2) add missing --active
cgoesche [Sat, 1 Nov 2025 23:45:32 +0000 (19:45 -0400)] 
bash-completion: (lastlog2) add missing --active

Signed-off-by: cgoesche <cgoesc2@wgu.edu>
6 days agobash-completion: (whereis) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:25:29 +0000 (13:25 -0400)] 
bash-completion: (whereis) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (wdctl) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:24:54 +0000 (13:24 -0400)] 
bash-completion: (wdctl) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (uuidd) add missing --cont-clock
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:24:12 +0000 (13:24 -0400)] 
bash-completion: (uuidd) add missing --cont-clock

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (unshare) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:22:46 +0000 (13:22 -0400)] 
bash-completion: (unshare) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (swapon) add missing --options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:21:14 +0000 (13:21 -0400)] 
bash-completion: (swapon) add missing --options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (sfdisk) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:20:24 +0000 (13:20 -0400)] 
bash-completion: (sfdisk) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (setsid) add missing --fork
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:18:58 +0000 (13:18 -0400)] 
bash-completion: (setsid) add missing --fork

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (scriptlive) add missing --echo
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:18:32 +0000 (13:18 -0400)] 
bash-completion: (scriptlive) add missing --echo

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (renice) add missing --relative
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:17:05 +0000 (13:17 -0400)] 
bash-completion: (renice) add missing --relative

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (more) add missing --exit-on-eof
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:16:21 +0000 (13:16 -0400)] 
bash-completion: (more) add missing --exit-on-eof

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (mkswap) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:15:58 +0000 (13:15 -0400)] 
bash-completion: (mkswap) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (mkfs.minix) add missing --lock
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:14:53 +0000 (13:14 -0400)] 
bash-completion: (mkfs.minix) add missing --lock

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (mkfs.cramfs) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:14:24 +0000 (13:14 -0400)] 
bash-completion: (mkfs.cramfs) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (mkfs.bfs) add missing --lock
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:13:50 +0000 (13:13 -0400)] 
bash-completion: (mkfs.bfs) add missing --lock

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (lsmem) add missing --split
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:12:56 +0000 (13:12 -0400)] 
bash-completion: (lsmem) add missing --split

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (lslogins) add missing --shell
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:12:32 +0000 (13:12 -0400)] 
bash-completion: (lslogins) add missing --shell

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (lscpu) add missing --hierarchic
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:11:59 +0000 (13:11 -0400)] 
bash-completion: (lscpu) add missing --hierarchic

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (lsclocks) add missing --no-discover-dynamic
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:11:29 +0000 (13:11 -0400)] 
bash-completion: (lsclocks) add missing --no-discover-dynamic

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (lsblk) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:10:58 +0000 (13:10 -0400)] 
bash-completion: (lsblk) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (losetup) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:10:19 +0000 (13:10 -0400)] 
bash-completion: (losetup) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (hwclock) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 17:09:51 +0000 (13:09 -0400)] 
bash-completion: (hwclock) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (hardlink) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:48:04 +0000 (12:48 -0400)] 
bash-completion: (hardlink) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (getopt) add missing --unknown
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:44:30 +0000 (12:44 -0400)] 
bash-completion: (getopt) add missing --unknown

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (fsck) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:43:29 +0000 (12:43 -0400)] 
bash-completion: (fsck) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (flock) add missing --verbose
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:41:25 +0000 (12:41 -0400)] 
bash-completion: (flock) add missing --verbose

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (findmnt) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:40:58 +0000 (12:40 -0400)] 
bash-completion: (findmnt) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (fincore) add missing --total
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:38:26 +0000 (12:38 -0400)] 
bash-completion: (fincore) add missing --total

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (fallocate) add missing --write-zeroes
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:35:05 +0000 (12:35 -0400)] 
bash-completion: (fallocate) add missing --write-zeroes

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (fadvise) add missing --fd
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:33:57 +0000 (12:33 -0400)] 
bash-completion: (fadvise) add missing --fd

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agofadvise: add --fd to the help output
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:32:59 +0000 (12:32 -0400)] 
fadvise: add --fd to the help output

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 days agobash-completion: (column) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:27:27 +0000 (12:27 -0400)] 
bash-completion: (column) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 days agobash-completion: (cfdisk) add missing --sector-size
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:26:04 +0000 (12:26 -0400)] 
bash-completion: (cfdisk) add missing --sector-size

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 days agobash-completion: (cal) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:24:20 +0000 (12:24 -0400)] 
bash-completion: (cal) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 days agobash-completion: (blockdev) add missing long options
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:17:31 +0000 (12:17 -0400)] 
bash-completion: (blockdev) add missing long options

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 days agobash-completion: (blkid) add missing --hint
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:16:22 +0000 (12:16 -0400)] 
bash-completion: (blkid) add missing --hint

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 days agobash-completion: (bits) add missing --binary
Christian Goeschel Ndjomouo [Fri, 31 Oct 2025 16:14:38 +0000 (12:14 -0400)] 
bash-completion: (bits) add missing --binary

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
8 days agolibfdisk: (dos) fix off-by-one in maximum last sector calculation
Karel Zak [Thu, 30 Oct 2025 11:11:43 +0000 (12:11 +0100)] 
libfdisk: (dos) fix off-by-one in maximum last sector calculation

The get_disk_ranges() function incorrectly capped the last usable
sector at UINT_MAX, which could cause an overflow when calculating
partition size for MBR partition tables.

MBR stores partition size as a 32-bit value with maximum UINT_MAX.
The partition size is calculated as: size = stop - start + 1

For a partition starting at sector 0:
- If stop = UINT_MAX: size = UINT_MAX + 1 (overflow!)
- If stop = UINT_MAX - 1: size = UINT_MAX (correct maximum)

This fixes the inconsistency where dos_init() correctly warns about
disks larger than UINT_MAX sectors (2TiB - 512 bytes for 512-byte
sectors), but get_disk_ranges() allowed creating partitions that
would overflow the 32-bit size field.

Addresses: https://issues.redhat.com/browse/RHEL-122367
Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agohwclock: skip RTC_PARAM_SET for --param-set with unchanged value
Bastian Krause [Fri, 24 Oct 2025 15:32:20 +0000 (17:32 +0200)] 
hwclock: skip RTC_PARAM_SET for --param-set with unchanged value

Parameters set with `hwclock --param-set` tend to be persisted in the
RTC's EEPROM. Writing the same value over and over again can wear out
the EEPROM (e.g. on each boot).
So read the current value first. Only if the parameter is changed,
actually write the new value.

This allows for easier integrations, especially since there is no
machine-readable way of retrieving the current value via hwclock.

Signed-off-by: Bastian Krause <bst@pengutronix.de>
9 days agoMerge branch 'issuerunfix' of https://github.com/Vogtinator/util-linux
Karel Zak [Wed, 29 Oct 2025 10:57:33 +0000 (11:57 +0100)] 
Merge branch 'issuerunfix' of https://github.com/Vogtinator/util-linux

* 'issuerunfix' of https://github.com/Vogtinator/util-linux:
  agetty: Fix reading /run/issue.d/ again

9 days agoMerge branch 'my-master-2' of https://github.com/Leefancy/util-linux
Karel Zak [Wed, 29 Oct 2025 10:57:05 +0000 (11:57 +0100)] 
Merge branch 'my-master-2' of https://github.com/Leefancy/util-linux

* 'my-master-2' of https://github.com/Leefancy/util-linux:
  Fix memory leak issue in read_Subid_range()

9 days agoMerge branch 'swapon-fstab-defaults' of https://github.com/zeha/util-linux
Karel Zak [Wed, 29 Oct 2025 10:56:42 +0000 (11:56 +0100)] 
Merge branch 'swapon-fstab-defaults' of https://github.com/zeha/util-linux

* 'swapon-fstab-defaults' of https://github.com/zeha/util-linux:
  swapon: (man page) use "defaults" (plural)

10 days agoagetty: Fix reading /run/issue.d/ again
Fabian Vogt [Tue, 28 Oct 2025 10:19:17 +0000 (11:19 +0100)] 
agetty: Fix reading /run/issue.d/ again

Commit 63f7dcb5b072 ("lib/config: Make /run path configurable") added
a second _PATH_SYSCONFDIR instead of _PATH_RUNSTATEDIR. Fix that.

2 weeks agolib/loopdev: avoid null pointer dereferences [coverity]
Karel Zak [Thu, 23 Oct 2025 10:34:08 +0000 (12:34 +0200)] 
lib/loopdev: avoid null pointer dereferences [coverity]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoFix memory leak issue in read_Subid_range()
fortunate-lee [Thu, 23 Oct 2025 07:01:31 +0000 (15:01 +0800)] 
Fix memory leak issue in read_Subid_range()

2 weeks agoswapon: (man page) use "defaults" (plural)
Chris Hofstaedtler [Wed, 22 Oct 2025 15:55:33 +0000 (17:55 +0200)] 
swapon: (man page) use "defaults" (plural)

A lot of documentation on the Internet seems to assume "defaults" is the
/correct/ default value when no other options are intended.
Documentation/example.files/fstab does not have an entry for swap, but
it shows "defaults" for other file systems.

It seems prudent to align on a single variant, at least in the
documentation, even if both are accepted by swapon.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2 weeks agoMerge branch 'optstr-test' of https://github.com/crobinso/util-linux
Karel Zak [Wed, 22 Oct 2025 09:25:01 +0000 (11:25 +0200)] 
Merge branch 'optstr-test' of https://github.com/crobinso/util-linux

* 'optstr-test' of https://github.com/crobinso/util-linux:
  tests: optstr: test redundant commas

2 weeks agoMerge branch 'PR/losetup-remove' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 22 Oct 2025 09:24:14 +0000 (11:24 +0200)] 
Merge branch 'PR/losetup-remove' of https://github.com/karelzak/util-linux-work

* 'PR/losetup-remove' of https://github.com/karelzak/util-linux-work:
  losetup: improve command line option processing
  lostup: report EACCES on loop-control
  losetup: improve --remove documentation
  losetup: make --remove a long-only option with mutual exclusivity
  lib/loopdev: introduce loopcxt_get_device_nr() helper
  losetup: add error feedback for --remove command

2 weeks agomount: add note about systemd and --all historical context
Karel Zak [Wed, 22 Oct 2025 08:42:36 +0000 (10:42 +0200)] 
mount: add note about systemd and --all historical context

Add information that mount -a was originally designed for init scripts
but many modern systemd-based distributions use systemd units instead
for mounting filesystems on boot in a more sophisticated way.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agomount: improve --all documentation regarding swap areas
Karel Zak [Wed, 22 Oct 2025 08:36:32 +0000 (10:36 +0200)] 
mount: improve --all documentation regarding swap areas

The --all option description did not mention that swap entries in
fstab are silently ignored. Add a note clarifying this behavior and
pointing users to swapon --all for enabling swap devices and files.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolosetup: improve command line option processing
Karel Zak [Tue, 21 Oct 2025 09:45:54 +0000 (11:45 +0200)] 
losetup: improve command line option processing

The options --detach, --remove, and --set-capacity are mutually
exclusive. We can assume the device name follows the options, which is
better than assuming the device name is specified as an option's
argument. This also allows the use of the existing mutually-exclusive
check.

 # losetup --remove --detach loop0
 losetup: /dev/--detach: remove failed: Success
 losetup: /dev/loop0: remove failed: Device or resource busy

is ugly.

Reported-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolostup: report EACCES on loop-control
Karel Zak [Tue, 21 Oct 2025 08:58:36 +0000 (10:58 +0200)] 
lostup: report EACCES on loop-control

Don't start scanning /dev/loop* after a failed access to
/dev/loop-control. It's a waste of time, and the user does not receive
a relevant error message.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolosetup: improve --remove documentation
Karel Zak [Thu, 16 Oct 2025 10:16:27 +0000 (12:16 +0200)] 
losetup: improve --remove documentation

Rewrite the --remove option description to clearly explain the
difference between --detach and --remove. Add a new LOOP DEVICE
LIFECYCLE section that describes the three stages: creation,
detachment, and removal, with corresponding ioctl names.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolosetup: make --remove a long-only option with mutual exclusivity
Karel Zak [Thu, 16 Oct 2025 09:56:08 +0000 (11:56 +0200)] 
losetup: make --remove a long-only option with mutual exclusivity

Change --remove from '-R, --remove' to a long-only option '--remove'.
This makes it consistent with other administrative options and adds
mutual exclusivity with other major actions like -d, -D, -a, -c, -f,
-j, -l, and -O.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolib/loopdev: introduce loopcxt_get_device_nr() helper
Karel Zak [Thu, 16 Oct 2025 09:42:03 +0000 (11:42 +0200)] 
lib/loopdev: introduce loopcxt_get_device_nr() helper

Add a new static helper function loopcxt_get_device_nr() to extract
the loop device number from the device path. This eliminates code
duplication in loopcxt_remove_device() and loopcxt_add_device().

The helper function supports both /dev/loop<N> and /dev/loop/<N>
formats and provides consistent error handling with debug logging.

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolosetup: add error feedback for --remove command
Karel Zak [Thu, 16 Oct 2025 09:22:47 +0000 (11:22 +0200)] 
losetup: add error feedback for --remove command

The remove_loop() function was silently failing without providing
any feedback to the user. This also fixes incorrect indentation
(spaces instead of tabs).

Signed-off-by: Karel Zak <kzak@redhat.com>
Reported-by: Benno Schulenberg <bensberg@telfort.nl>
3 weeks agotests: optstr: test redundant commas
Cole Robinson [Fri, 17 Oct 2025 15:11:38 +0000 (11:11 -0400)] 
tests: optstr: test redundant commas

optstr, used for parsing mount option lists, eats leading,
trailing, and duplicated commas, but I can't find any test coverage
for that behavior.

Amend the existing optstr test to hit all the cases I can think of

Signed-off-by: Cole Robinson <crobinso@redhat.com>
3 weeks agotreewide: use is_dotdir_dirent() helper
Karel Zak [Wed, 15 Oct 2025 13:46:06 +0000 (15:46 +0200)] 
treewide: use is_dotdir_dirent() helper

This simplifies the code by using the is_dotdir_dirent() helper
function instead of manual strcmp() checks for "." and ".." directory
entries across multiple utilities.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agotests: (configs) add sorting and masking test
Karel Zak [Wed, 15 Oct 2025 13:30:06 +0000 (15:30 +0200)] 
tests: (configs) add sorting and masking test

Add a new test that verifies:
- Main config file appears first
- Drop-in files are sorted alphabetically
- Files from /etc mask same-named files from /usr
- Priority ordering is correct (etc > usr)

The test creates mmm.conf in both /etc and /usr to verify
that the /etc version takes precedence and /usr version is
masked (not included in output).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: simplify merge error checking
Karel Zak [Wed, 15 Oct 2025 13:18:05 +0000 (15:18 +0200)] 
lib/configs: simplify merge error checking

Combine the three config_merge_list() calls into a single
conditional statement to reduce repetitive error checking.
The calls are short-circuited on first failure.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: eliminate counter variable
Karel Zak [Wed, 15 Oct 2025 13:15:02 +0000 (15:15 +0200)] 
lib/configs: eliminate counter variable

Remove the counter variable and return list_count_entries()
directly. This simplifies the code by calculating the count
only when needed (on success path) rather than tracking it
throughout the function.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: add head parameter to configs_refer_filename()
Karel Zak [Wed, 15 Oct 2025 13:11:25 +0000 (15:11 +0200)] 
lib/configs: add head parameter to configs_refer_filename()

Allow configs_refer_filename() to add entries at either the head
or tail of the list by adding a 'head' parameter. This simplifies
the code for adding the main config file, eliminating the need to
add to the tail and then move to the head.

When head=1, use list_add() to prepend to the list.
When head=0, use list_add_tail() to append to the list.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: simplify variable names
Karel Zak [Wed, 15 Oct 2025 13:04:24 +0000 (15:04 +0200)] 
lib/configs: simplify variable names

Shorten variable and parameter names for better readability:

Parameters:
- etc_subdir -> etcdir
- run_subdir -> rundir
- usr_subdir -> usrdir
- config_name -> confname
- config_suffix -> suffix

Local variables:
- etc_file_list -> etc_list
- run_file_list -> run_list
- usr_file_list -> usr_list

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: merge new_list_entry() and configs_add_filename()
Karel Zak [Wed, 15 Oct 2025 12:59:44 +0000 (14:59 +0200)] 
lib/configs: merge new_list_entry() and configs_add_filename()

Introduce configs_refer_filename() which merges the functionality
of new_list_entry() and configs_add_filename() while avoiding
unnecessary string duplication.

The new function takes ownership of the filename pointer directly
instead of using strdup(), which eliminates one allocation per
config file entry. Callers no longer need to free the filename
after adding it to the list, as ownership is transferred to the
list element.

This improves both performance and code clarity by making the
ownership semantics explicit.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: refactor directory list merging
Karel Zak [Wed, 15 Oct 2025 12:52:29 +0000 (14:52 +0200)] 
lib/configs: refactor directory list merging

The original implementation used complex nested loops to merge
configuration file lists from different directories. This commit
simplifies the code by introducing a new config_merge_list()
function that handles the merging logic.

Changes:
- Add config_merge_list() to merge lists with duplicate detection
- Add config_cmp() comparison function using strcoll() (consistent
  with alphasort() behavior from scandirat())
- Add configs_add_filename() helper to reduce code duplication
- Simplify ul_configs_file_list() by replacing ~120 lines of
  merging logic with 3 calls to config_merge_list()
- Remove intermediate etc_run_file_list, merge directly to output
- Update read_dir() to return 0/-ENOMEM instead of entry count
- Use list_count_entries() to get final count

The new config_merge_list() moves entries directly from source
lists to the destination list without extra allocations, making
it more efficient than the previous approach.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoupdate .gitignore
Karel Zak [Wed, 15 Oct 2025 09:48:26 +0000 (11:48 +0200)] 
update .gitignore

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agotests: (configs) check for scandirat()
Karel Zak [Wed, 15 Oct 2025 09:34:26 +0000 (11:34 +0200)] 
tests: (configs) check for scandirat()

The function may be unsupported on musl libc.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: simplify suffix verification
Karel Zak [Wed, 15 Oct 2025 08:32:26 +0000 (10:32 +0200)] 
lib/configs: simplify suffix verification

Use ul_endswith() to simplify the code.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/fileutils: add is_dotdir_dirent()
Karel Zak [Wed, 15 Oct 2025 08:30:34 +0000 (10:30 +0200)] 
lib/fileutils: add is_dotdir_dirent()

This code pattern is repeated on many places, let's move it to
simple inline function.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agotests: (configs) add file listings to expected output
Karel Zak [Tue, 14 Oct 2025 11:20:42 +0000 (13:20 +0200)] 
tests: (configs) add file listings to expected output

Add sorted file listings to the configs test output to help debug
platform-specific test failures. Each subtest now outputs the actual
files created in the test directory before running the config helper,
making it easier to identify issues with filesystem ordering or file
creation problems.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/config: fix file counter
Karel Zak [Tue, 14 Oct 2025 10:59:05 +0000 (12:59 +0200)] 
lib/config: fix file counter

We need to count only files in the final list, not in the temporary
lists.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: introduce config_mk_path() helper
Karel Zak [Thu, 9 Oct 2025 20:19:40 +0000 (22:19 +0200)] 
lib/configs: introduce config_mk_path() helper

Refactor main_configs() and read_dir() to use a new helper function
that combines path construction with existence and type checking.
This reduces code duplication and simplifies the logic.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agotests: add regression tests for ul_configs_file_list()
Karel Zak [Thu, 9 Oct 2025 20:04:19 +0000 (22:04 +0200)] 
tests: add regression tests for ul_configs_file_list()

Add comprehensive test script for configuration file list functionality
with the following test cases:

- main-etc: Main config file in /etc
- main-usr: Main config file fallback to /usr
- dropin-etc: Drop-in files from /etc
- dropin-usr: Drop-in files from /usr
- combined: Main config + drop-ins from multiple directories
- masking: Same basename in multiple directories (masking behavior)
- no-project: Configuration without project subdirectory

The tests verify proper file discovery, priority ordering across /etc,
/run, and /usr directories, and file masking behavior according to the
Configuration Files Specification.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/configs: add test program for ul_configs_file_list()
Karel Zak [Thu, 9 Oct 2025 20:02:24 +0000 (22:02 +0200)] 
lib/configs: add test program for ul_configs_file_list()

Add a test program with command line options to test the configuration
file list functionality. The test program allows specifying custom paths
for /etc, /run, and /usr directories, project name, config name, and suffix.

This enables testing the priority ordering and file discovery logic
of ul_configs_file_list() from the command line.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolib/config: Make /run path configurable
Karel Zak [Thu, 9 Oct 2025 18:35:26 +0000 (20:35 +0200)] 
lib/config: Make /run path configurable

Avoid hardcoded paths when writing regression tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'fix/umount_no_verbose_for_non_root' of https://github.com/cgoesche...
Karel Zak [Tue, 14 Oct 2025 08:58:08 +0000 (10:58 +0200)] 
Merge branch 'fix/umount_no_verbose_for_non_root' of https://github.com/cgoesche/util-linux-fork

* 'fix/umount_no_verbose_for_non_root' of https://github.com/cgoesche/util-linux-fork:
  umount: consider helper return status for success message

3 weeks agoMerge branch 'test--lsfd-revise-rpi5' of https://github.com/masatake/util-linux
Karel Zak [Tue, 14 Oct 2025 08:54:14 +0000 (10:54 +0200)] 
Merge branch 'test--lsfd-revise-rpi5' of https://github.com/masatake/util-linux

* 'test--lsfd-revise-rpi5' of https://github.com/masatake/util-linux:
  tests: (lsfd/mkfds-unix-dgram) skip if the unix diag netlink interface is not available
  tests: (lsfd-functions.sh) make lsfd_check_sockdiag usable in subtests
  tests: (lsfd/mkfds-unix-stream-requiring-sockdiag) revise the test description

3 weeks agoMerge branch 'fix/test_libmount_explicit_rw' of https://github.com/cgoesche/util...
Karel Zak [Tue, 14 Oct 2025 08:52:31 +0000 (10:52 +0200)] 
Merge branch 'fix/test_libmount_explicit_rw' of https://github.com/cgoesche/util-linux-fork

* 'fix/test_libmount_explicit_rw' of https://github.com/cgoesche/util-linux-fork:
  tests: (libmount) improve explicit loop read-write mount check

3 weeks agoMerge branch 'fix/mount_bash_comp' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Tue, 14 Oct 2025 08:45:14 +0000 (10:45 +0200)] 
Merge branch 'fix/mount_bash_comp' of https://github.com/cgoesche/util-linux-fork

* 'fix/mount_bash_comp' of https://github.com/cgoesche/util-linux-fork:
  bash-completion: (mount) add missing options

3 weeks agoMerge branch 'feat/add_json_opt_lslogins' of https://github.com/cgoesche/util-linux...
Karel Zak [Tue, 14 Oct 2025 08:43:13 +0000 (10:43 +0200)] 
Merge branch 'feat/add_json_opt_lslogins' of https://github.com/cgoesche/util-linux-fork

* 'feat/add_json_opt_lslogins' of https://github.com/cgoesche/util-linux-fork:
  bash-completion: (lslogins) add --list-columns option
  lslogins: (man) add --list-columns description
  lslogins: add -H and --list-columns option; declutter --help output
  lslogins: (man) add --json information
  bash-completion: (lslogins) add --json completion
  tests: (lslogins) test --json output mode
  lslogins: add JSON output format mode

3 weeks agoMerge branch 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche...
Karel Zak [Tue, 14 Oct 2025 08:38:07 +0000 (10:38 +0200)] 
Merge branch 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche/util-linux-fork

* 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche/util-linux-fork:
  treewide: consolidate --list-columns option in usage() to USAGE_LIST_COLUMNS_OPTION()
  include/c.h: add USAGE_LIST_COLUMNS_OPTION() macro

3 weeks agoMerge branch 'tests--kill-make-test-bits' of https://github.com/masatake/util-linux
Karel Zak [Tue, 14 Oct 2025 08:35:26 +0000 (10:35 +0200)] 
Merge branch 'tests--kill-make-test-bits' of https://github.com/masatake/util-linux

* 'tests--kill-make-test-bits' of https://github.com/masatake/util-linux:
  ts/kill/decode: compare decoded output in an architecture-independent way
  ts/kill/decode: check the availability of "sed"
  ts/kill/decode: consider arch dependent signum/name association