Karel Zak [Thu, 2 Oct 2025 11:38:13 +0000 (13:38 +0200)]
bash-completion: add bits to dist tarball
The bits command was added in commit 6e1301d59 (text-utils: add bits
command) but the bash-completion file was not added to the autotools
Makemodule.am, causing it to be missing from release tarballs.
This resulted in meson build failures when using the tarball with
bash-completion installed, as meson.build references the file but
it doesn't exist in the tarball.
Fixes: https://github.com/util-linux/util-linux/issues/3766 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 2 Oct 2025 09:52:52 +0000 (11:52 +0200)]
Merge branch 'PR/agetty-issue-read' of https://github.com/karelzak/util-linux-work
* 'PR/agetty-issue-read' of https://github.com/karelzak/util-linux-work:
lib/configs: improve readability
agetty: use standard path macros
build-sys: make sure _PATH_SYSCONFDIR is defined
The current \4 and \6 issue file escapes implementation is inferior. It
uses get getifaddrs() to get a list of IP addresses. This function does not
provide enough information to discriminate between stable IP addresses and
ephemeral addresses. As a result, especially \6 often gives unreliable
results.
The code is actually unable to get list of all interfaces, so a proper out
of the box IP address reporting depends on external tools that generate
issue file with the interfaces list.
The netlink messages are already used, but only as a change notifier. The
contents is not used, even if it contains exact information about the
change. As a result, change processing is triggered even for unrelated
network changes like IPv6 router advertisement.
The new implementation uses the new netaddrq library. It reports more
reliable results especially for IPv6.
Additionally, two new escapes are implemented:
\a Report all interfaces and assigned addresses that are considered as
reliable.
\A Report all interfaces and all assigned addresses.
TODO:
To prevent overflooding of the console, the list is currently limited to 12
interfaces. It would be nice to make it configurable.
Two pass processing of issue files. First pass just collects IP protocols
and list of interfaces (in future interface patterns). Now it always
processes both IPv4 and IPv6 on all interfaces. Not so bad, as \a is smart
enough to display just the useful part.
Maybe implement more options and formatting support for \a and \A.
Maybe implement interface filter globs or regexps for \a and \A. Still not
so bad, as \a automatically skips interfaces without reliable addresses
(e. g. lo or TUN).
To support netlink and IP address processing, two new library files were
added:
netlink: Generic netlink message processing code converting netlink
messages to calls of callbacks with a pre-processed data.
netaddrq: A code that gets and maintains linked list of the current
interfaces and assigned IP addresses. It also provides a rating of IP
addresses based on its "quality", i. e. type of address, validity, lifetime
etc.
Karel Zak [Wed, 1 Oct 2025 13:13:02 +0000 (15:13 +0200)]
Merge branch 'feat/swapon_translate_col_names' of https://github.com/cgoesche/util-linux-fork
* 'feat/swapon_translate_col_names' of https://github.com/cgoesche/util-linux-fork:
bash-completion: (swapon) add --annotation option
swapon: document --annotation option on the man page
swapon: control column header tooltips with --annotation
swapon: annotate column header names with OSC8 hyperlinks
lib/strutils: add helper function for --annotation option
libsmartcols: new scols_column_{refer,get}_annotation routines
Lukas Herbolt [Wed, 1 Oct 2025 11:54:50 +0000 (13:54 +0200)]
fallocate: allow O_CREATE if mode is FALLOC_FL_WRITE_ZEROES
With the new flag we can create the ZEROED allcoated files directly and not
in the two steps. Removing FALLOC_FL_WRITE_ZEROES from the flags of not using
O_CREATE on open().
Karel Zak [Wed, 1 Oct 2025 11:54:08 +0000 (13:54 +0200)]
Merge branch 'configs3' of https://github.com/schubi2/util-linux
* 'configs3' of https://github.com/schubi2/util-linux:
Using fix issue dir path "/usr/lib" for agetty
agetty: using configs lib for parsing issue files
libcommon: added lib "configs" for parsing configuration files in the correct order
Masatake YAMATO [Sun, 31 Aug 2025 01:03:03 +0000 (10:03 +0900)]
lsfd: refer to /proc/$pid/map_files if a mapped file is masked
To extract file information, lsfd called stat(2) on the the file name
found in /proc/$pid/maps. However, lsfd may retrieve information for
the wrong file if the file is bind-mount'ed after the process maps the
file.
To obtain the information about the originally mapped file, this
change makes lsfd call fstat(2) on the corresponding entry under
/proc/$pid/map_files avoiding the bind-mount ambiguity.
swapon: control column header tooltips with --annotation
Whether column header names should be annotated can be specified
with the --annotation option which takes the following three
arguments: 'auto', 'never' and 'always', where the former is the
default and makes it so that annotations are only added when the
output device is a terminal. If the option is omitted the 'auto'
behavior should be expected.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
swapon: annotate column header names with OSC8 hyperlinks
Column header names are annotated with OSC8 hyperlinks to
provide tooltips with a description of the column.
This is mainly motivated by the fact that column headers
are currently not translated, so as an alternative we will
provide a column description translated according to the
environment locale setting.
Addresses: #1291 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
lib/strutils: add helper function for --annotation option
This function helps evaluates the --annotation option argument
and determines whether annotations are enabled or not.
It is identical to the hyperlinkwanted() routine, and although
that forms some form of redundancy, it is intentionally kept
seperate for potential future changes.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Karel Zak [Wed, 24 Sep 2025 08:06:04 +0000 (10:06 +0200)]
Merge branch 'PR/Benno-23Sep' of https://github.com/karelzak/util-linux-work
* 'PR/Benno-23Sep' of https://github.com/karelzak/util-linux-work:
fallocate: (man,usage) correct the alphabetical sorting of the options
fallocate: (man) slightly improve the grammar of two sentences
fallocate: redo four tweaks that were accidentally undone
column: (usage) wrap two descriptions, to make them fit within 80 columns
column: (usage) correct the description of --wrap-separator
getopt: (usage) make the description of -U fit within 80 columns
Karel Zak [Wed, 24 Sep 2025 08:05:26 +0000 (10:05 +0200)]
Merge branch 'master' of https://github.com/wuguanghao3/util-linux
* 'master' of https://github.com/wuguanghao3/util-linux:
losetup: Add the --remove/-R parameter to remove loop devices
losetup: rename function *_delete_* to *_detach_*
libsmartcols: new scols_column_{refer,get}_annotation routines
The new routines can be used to add an annotation to columns
which are intended to serve as descriptions for column headers.
These annotations are formatted with OSC8 escape sequences and
then sent to the output stream. A supporting terminal can then
display the formatted string as a tooltip.
This can be fairly useful when an application wants to provide
a translated description for a column header name, since the
latter is sometimes a mere abbreviation and not necessarily
telling enough.
Addresses: #1291 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Karel Zak [Tue, 23 Sep 2025 09:04:15 +0000 (11:04 +0200)]
liblastlog2: refactor conditional assignments for better readability
Split conditional assignments like 'if ((ret = func()) != 0)' into
separate assignment and comparison statements for improved code clarity,
maintainability, and debugging.
Karel Zak [Tue, 23 Sep 2025 08:46:59 +0000 (10:46 +0200)]
liblastlog2: fix operator precedence in conditional assignments
Fix operator precedence in ll2_rename_user() where != comparison was
taking precedence over assignment, causing retval to be assigned 0 or 1
instead of the actual function return value.
Fixes: https://github.com/util-linux/util-linux/issues/3756 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 22 Sep 2025 13:51:06 +0000 (15:51 +0200)]
tools: improve git-version-bump with validation and help
- Add --help option with usage information
- Validate script runs only on stable/vX.Y branches
- Validate version format (X.Y, X.Y.Z, X.Y-rcN, X.Y.Z-rcN)
Karel Zak [Mon, 22 Sep 2025 13:21:18 +0000 (15:21 +0200)]
tools: improve git-version-next to always output version variables
- Always output UL_NEXT_FINAL_RELEASE (previously only for RC releases)
- Add UL_LAST_FINAL_RELEASE for last stable (non-RC) release
- Remove _RAW variables from output for cleaner interface
The UL_NEXT_FINAL_RELEASE now represents the version that will be
released after code stabilization, while UL_LAST_FINAL_RELEASE
represents the last stable release without -rc suffix.
- Only works on stable/* branches (releases are generated from stable branches)
- Supports util-linux versioning: vX.Y (major), vX.Y.Z (maintenance)
- Command-line options: --rc, --release-master, --release-update
- Safety check prevents --release-master on branches with existing releases
- Testing support via --last-release and --last-xy-release overrides
Version Schema:
Major releases: vX.Y-rc1, vX.Y-rc2, [vX.Y-rc3], vX.Y
Maintenance releases: vX.Y.Z-rc1, vX.Y.Z
Sam Fink [Wed, 17 Sep 2025 14:04:51 +0000 (10:04 -0400)]
libblkid: Fix probe_ioctl_tp assigning BLKGETDISKSEQ as physical sector size
Fix issue introduced by PR#2908 in probe_ioctl_tp where the BLKGETDISKSEQ ioctl
result is incorrectly assigned to the topology with
blkid_topology_set_physical_sector_size instead of blkid_topology_set_diskseq.
This issue was observed while using a Debian 13 container on a RHEL 9.4 host
attempting to format a volume. The physical sector size was incorrectly
reported as 3. This issue also presents with the fdisk command,
which also uses this library to resolve physical sector size of devices.
Karel Zak [Wed, 17 Sep 2025 10:58:59 +0000 (12:58 +0200)]
agetty: fix erasure of escape sequences and tab characters
When escape sequences (like arrow keys) or tab characters are entered
at the login prompt, they are properly visualized but only partially
erasable with backspace. This is because the erase logic assumes each
stored character corresponds to one visual character, but escape
sequences display as "^[" (2 chars) and tabs expand to multiple spaces.
Track visual character width for each stored byte in a parallel array.
When erasing, use the stored visual width to properly erase all
displayed characters for that input byte.
Fixes: https://github.com/util-linux/util-linux/issues/3624 Signed-off-by: Karel Zak <kzak@redhat.com>
(Mentioning -u instead of -n, and falsely claiming emptiness.)
Now the above command will report:
blkid: invalid argument: no
(I don't think option -n needs to be mentioned, as it will be obvious
when inspecting the command line. Not mentioning the option allows
reusing an existing error message, avoiding needless ballooning and
allowing the patch to be applied to the stable branch.)
Karel Zak [Mon, 15 Sep 2025 14:14:08 +0000 (16:14 +0200)]
column: add --wrap-separator option for custom text wrapping
Add a new --wrap-separator option that allows users to specify custom
separator characters for text wrapping within table columns. When used
with --table-wrap, the separator is replaced with newlines to enable
wrapping at specific points rather than just by column width.
The implementation:
- Processes wrap separator replacement in modify_table() after column
wrap flags are set
- Uses scols_cell_refer_memory() for data containing embedded nulls
- Enables scols_wrapzero_nextchunk for columns with wrapping enabled
- Only applies to columns that have the wrap flag set via --table-wrap
Example usage:
$ echo -e 'Name:Desc\nJohn:A|software|dev' | \
column --table --separator ':' \
--table-wrap 2 --wrap-separator '|'
Name Desc
John A
software
dev
Fixes: https://github.com/util-linux/util-linux/issues/3739 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 11 Sep 2025 07:35:58 +0000 (09:35 +0200)]
libmount: don't report fsconfig errors with "nofail"
The new kernel API returns EINVAL on FSCONFIG_CMD_CREATE if the mount
source is inaccessible. We do not want to report this as an error when
the "nofail" mount option is specified.
Note that EINVAL may also be returned by other fsconfig() settings, so
we need to check whether a source is specified and whether it is really
inaccessible. This is just a heuristic (as with the old mount(2)).
Fixes: https://github.com/util-linux/util-linux/issues/3741 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 8 Sep 2025 10:03:32 +0000 (12:03 +0200)]
Merge branch 'master' of https://github.com/mariobl/util-linux
* 'master' of https://github.com/mariobl/util-linux:
Fix another issue in login.1.adoc
sfdisk.8.adoc: Replace --help and --version with external entity
Fix markup in pam_lastlog2.8.adoc
Fix markup in column.1.adoc
Fix markup in mount.8.adoc
Fix typo and markup in getopt.1.adoc
Fix markup in lsfd.1.adoc
Fix markup, grammar and spelling in scols-filter.5.adoc
Fix login.1.adoc
Karel Zak [Mon, 8 Sep 2025 09:44:16 +0000 (11:44 +0200)]
libfdisk: improve collision reporting
In some cases, a collision occurs in the first sector. Creating a new
partition table overwrites this sector, but updating an existing table
does not. In the latter case, promising to wipe the collision is a
bug.
Because we cannot know whether the collision is expected (e.g., hybrid
or boot disks) or unintended, we inform the user and let them decide.
libfdisk can wipe the unwanted signature only when creating a new
partition table; otherwise, the user can use wipefs.
This commit introduces fdisk_is_collision_area(), an API to detect
where the collision occurs. The function is generic and not limited to
the first sector.
Fixes: https://github.com/util-linux/util-linux/issues/3659 Signed-off-by: Karel Zak <kzak@redhat.com>
sfdisk.8.adoc: Replace --help and --version with external entity
sfdisk.8.adoc still had the literal --help and --version options, in contrary to all other .adoc files, which have the man-common/help-version.adoc entity.
Karel Zak [Wed, 3 Sep 2025 08:54:06 +0000 (10:54 +0200)]
libfdisk: (script) fix device name separator parsing
In the named-fields script format, the colon is used as the separator
between the device name and other values. The device name may also
contain colons. This commit ensures it is treated as a separator only
when there is a space before or after the colon.
Note that the device name is optional and may be omitted. There is no
escaping for problematic characters in the name. Use " : " as the
separator.
Fixes: https://github.com/util-linux/util-linux/issues/3723 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 3 Sep 2025 08:06:39 +0000 (10:06 +0200)]
Merge branch 'feat/allow_killing_with_pidfd' of https://github.com/cgoesche/util-linux-fork
* 'feat/allow_killing_with_pidfd' of https://github.com/cgoesche/util-linux-fork:
textual: rename list_colunms() to list_columns() and remove trailing whitespaces
include/strutils: add missing header guard comment
lib: fix bad indentation in meson.build
kill: add support for race-free process kills using pidfd inodes
Karel Zak [Wed, 3 Sep 2025 07:52:07 +0000 (09:52 +0200)]
Merge branch 'feat/lslocks_output_env' of https://github.com/cgoesche/util-linux-fork
* 'feat/lslocks_output_env' of https://github.com/cgoesche/util-linux-fork:
lslocks: (man) add LSLOCKS_COLUMNS description in new ENVIRONMENT section
lslocks: add support for LSLOCKS_COLUMNS environmental variable
Karel Zak [Wed, 3 Sep 2025 07:47:04 +0000 (09:47 +0200)]
Merge branch 'PR/libmount-canonicalize-cleanup' of https://github.com/karelzak/util-linux-work
* 'PR/libmount-canonicalize-cleanup' of https://github.com/karelzak/util-linux-work:
lib/canonicalize: use ul_ prefix
lib/canonicalize: introduce generic drop-permission caller
meson: cleanup tests to use libcommon.la
autotools: cleanup tests to use libcommon.la
tests: add canonicalize test
lib/canonicalize: refactor canonicalize_path()
lib/canonicalize: rename to ul_absolute_path()
kill: add support for race-free process kills using pidfd inodes
The 6.9 Linux kernel added support for pidfds which introduces inodes
that stay unique for the system lifetime and can be used to reference
a process with both its traditional pid and pid fd inode number.
This enables race-free killing of processes and protects from false
referencing due to pid rollovers.
This patch adds a new way of addressing processes with the format
'pid:pidfd_inode'. When the new format is used, 'kill' assumes the user wishes
to use a pidfd to signal a process, and will therefore use pidfd_* routines
to complete the task if the provided inode matches the one from a previously
acquired pidfd.
Addresses: #3252 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
This patch makes it so that we continue parsing all CLI options even
when we find -H/--list-columns. Therefore we don't miss any format
specifying options, namely --json and --raw, and print the columns
in the desired form.
Closes: #3725 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>