Karel Zak [Tue, 26 Aug 2025 09:25:18 +0000 (11:25 +0200)]
Merge branch 'fix/clarify_long_flag_in_getopt_script_examples' of https://github.com/cgoesche/util-linux-fork
* 'fix/clarify_long_flag_in_getopt_script_examples' of https://github.com/cgoesche/util-linux-fork:
getopt: clarify the use of '--long' instead of '--longoptions' in shell examples
Karel Zak [Tue, 26 Aug 2025 09:22:41 +0000 (11:22 +0200)]
Merge branch 'feat/support_lsblk_columns_env' of https://github.com/cgoesche/util-linux-fork
* 'feat/support_lsblk_columns_env' of https://github.com/cgoesche/util-linux-fork:
lsblk: add support for LSBLK_COLUMNS environmental variable as an alternative to --output
Karel Zak [Tue, 26 Aug 2025 09:20:16 +0000 (11:20 +0200)]
Merge branch 'fix/document_special_chars_in_getopt' of https://github.com/cgoesche/util-linux-fork
* 'fix/document_special_chars_in_getopt' of https://github.com/cgoesche/util-linux-fork:
getopt: document special symbols that should not be used as option characters
Karel Zak [Tue, 26 Aug 2025 09:16:41 +0000 (11:16 +0200)]
Merge branch 'PR/mount-api-includes' of https://github.com/karelzak/util-linux-work
* 'PR/mount-api-includes' of https://github.com/karelzak/util-linux-work:
include/mount-api-utils: update to recent kernel
include/mount-api-utils: avoid using sys/mount.h
Sumanth Korikkar [Fri, 22 Aug 2025 15:13:53 +0000 (17:13 +0200)]
chmem: Remove commit - chmem print warnings about failures always
Users do not care which blocks are set offline, when using size option
Consistently printing warnings/errors in this case may confuse them and
create the false impression that the enable/disable operation itself has
failed.
If size option succeeds, chmem should not print errors/warnings.
Hence, revert commit 48675a744 ("chmem: print warnings about failures always (not only with --verbose)")
cgoesche [Sun, 24 Aug 2025 00:25:36 +0000 (20:25 -0400)]
lscpu: add 'microcode' information to the CPU summary
The procfs provides microcode revision information on
supported platforms (probably only x86 for now).
It can be useful to show this in the output of lscpu
for various use cases, e.g. applications that wish to
make sure that a specific microcode version has been
loaded.
Addresses: #3050 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
cgoesche [Fri, 22 Aug 2025 21:31:24 +0000 (17:31 -0400)]
getopt: document special symbols that should not be used as option characters
getopt(3) routines return `?` or `:` when an unknown option character is encountered
or an option is missing its required argument, respectively. It also disallows
`;` as an option character. Documenting this makes users aware that they may not use
these reserved symbols as option characters, e.g. `-?` which is used in some older programs.
Addresses: #2995 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Jérôme Poulin [Fri, 22 Aug 2025 03:54:17 +0000 (23:54 -0400)]
zramctl: fix MEM-USED column description
The MEM-USED column was incorrectly documented as showing current
memory consumption. This is due to confusing naming in the kernel's
zram implementation:
- Kernel field "mem_used_total" (3rd in mm_stat) = current memory usage
- Kernel field "mem_used_max" (5th in mm_stat) = peak memory usage
zramctl maps these as:
- TOTAL column <= mem_used_total (current usage)
- MEM-USED column <= mem_used_max (peak usage)
The misleading "MEM-USED" name suggests current usage, but it actually
shows the peak memory usage (high water mark) since device creation
or last reset. This is tracked by the kernel's max_used_pages which
only increases when current usage exceeds the stored maximum.
Fixed description from:
"memory zram have been consumed to store compressed data" to
"peak memory usage to store compressed data".
Karel Zak [Thu, 21 Aug 2025 09:35:17 +0000 (11:35 +0200)]
lscpu: use maximum CPU speed from DMI, avoid duplicate version string
* Read maximum CPU speed from DMI
* Don't use max speed if nonsensical
* Avoid appending "CPU @ speed" to the version string if it's already included.
(This is a code robustness improvement as DMI is currently read for ARMs only,
and the issue was detected on Intel.)
Fixes: https://github.com/util-linux/util-linux/commit/a772d7c493afcec32f0123fc947013f74db6e45d Signed-off-by: Karel Zak <kzak@redhat.com>
Naoki Wake [Tue, 19 Aug 2025 01:46:08 +0000 (18:46 -0700)]
kill: usage: fix wrapped indent in -l/--list description
Increase the indentation of the continuation line from one to two
spaces to match the common util-linux help style (see
Documentation/howto-usage-function.txt). This touches a translatable
string. Whitespace-only change; no functional impact.
Signed-off-by: Naoki Wake <wakeke.rainbowearth@gmail.com>
Masatake YAMATO [Fri, 3 Jan 2025 18:50:01 +0000 (03:50 +0900)]
lsfd: decode protocol numbers of RAW and RAW6 sockets
NOTE: this chage breaks compatibility of existing -Q expression used
in a shell script; the data type of RAW.PROTOCOL has changed from
<number> to <string>.
With this change, lsfd decodes RAW.PROTOCOL with a built-in table
based on linux/in.h and getprotobynumber(3) that may refer to
/etc/protocols internally.
In addition, this change adds RAW.PROTOCOL.RAW column that holds
the original protocol numbers.
Thomas Weißschuh [Tue, 19 Aug 2025 16:13:02 +0000 (18:13 +0200)]
lsclocks: stop using MAX_CLOCKS
MAX_CLOCKS is only available in the kernel UAPI headers and not libc
headers. Switch back to a hardcoded value. This value is a stable ABI
anyways and matches the other fallback definitions.
Fixes: d3c49ee062f7 ("lsclocks: use MAX_CLOCKS, improve indention") Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
logger: fix incorrect warning message when both --file and a message are specified
Logger warns that when both --file and a message are given, the message is ignored.
It does the opposite. Fix the warning message to conform to the observed behavior.
Example:
echo "You will not see this file in the log" > file.txt
logger -f file.txt "You will see this message in the log"
Signed-off-by: Alexander Kappner <agk@godking.net>
Zhang Yi [Wed, 13 Aug 2025 02:40:15 +0000 (10:40 +0800)]
fallocate: add FALLOC_FL_WRITE_ZEROES support
The Linux kernel (since version 6.17) supports FALLOC_FL_WRITE_ZEROES in
fallocate(2). Add support for FALLOC_FL_WRITE_ZEROES to the fallocate
utility by introducing a new option -w|--write-zeroes.
Karel Zak [Tue, 12 Aug 2025 12:47:49 +0000 (14:47 +0200)]
swapon: (man page) add details about fstab configuration
The fstab(5) man page already describes some basic aspects of "swap,"
but it makes sense to be more specific in the swapon man page and
describe everything in one place, serving as a normative reference for
what is expected on Linux in fstab for swap.
Fixes: https://github.com/util-linux/util-linux/issues/3667 Signed-off-by: Karel Zak <kzak@redhat.com>
Add support for the auxiliary posix clocks introduced in Linux 6.17.
When auxiliary clocks are not supported, no output line is generated.
When an auxiliary clock is not enabled an output line without TIME
columns is generated.
chrt: (man,usage) put --pid first in synopses and examples, for clarity
When --pid is among the options, it is clearest when it is given as the
first option, because then it doesn't sit between the policy option and
the somewhat related priority value. It creates some kind of symmetry:
the --pid option first, then other things, and the actual PID last.
Let's use these simple functions to report what the last operation or
status detected by the library means to the filesystem. It will be
used by the fanotify monitor as well.
Karel Zak [Tue, 10 Jun 2025 11:51:23 +0000 (13:51 +0200)]
libmount: (monitor) optimize inotify utab watch
Don't repeat no-op inotify_add_watch() calls. This happens when we
monitor the /run[/mount] directory before the utab.event file exists.
The old version just tries to create a watch and ignores ENOENT
errors. It seems better to remember the path of the last created watch
and not repeat it.
Karel Zak [Tue, 27 May 2025 11:14:34 +0000 (13:14 +0200)]
libmount: (monitor) clean up internal names
In future changes, we need to process active monitor entries in entry
type-specific code to return data from events.
This requires a slight change in the function's logic, so it makes
sense to rename the function according to the new logic, meaning
changes --> active, verify --> process.
Karel Zak [Tue, 5 Aug 2025 11:22:10 +0000 (13:22 +0200)]
Merge branch 'PR/libmount-excl' of https://github.com/karelzak/util-linux-work
* 'PR/libmount-excl' of https://github.com/karelzak/util-linux-work:
mount: add --exclusive command line option
libmount: Add support for FSCONFIG_CMD_CREATE_EXCL
lib: add FSCONFIG_CMD_CREATE_EXCL
Karel Zak [Thu, 31 Jul 2025 10:31:36 +0000 (12:31 +0200)]
mount: add --exclusive command line option
The new option ensures that the kernel does not reuse existing
superblock.
The new option is available to non-root users as it does not affect
the superblock itself or any other aspects of the mount process. It
makes the current mounting more restrictive, so it makes sense to
allow it for non-root users.
curses is special in that it's able to find ncurses in a lot more locations that ncurses, which only looks at pkg-config and cmake. This is somewhat useful with exotic OSes like macOS.
chrt: Allow optional priority for non‑prio policies without --pid
This extends commit e7a2d62434c2
("chrt: Make priority optional for policies that don't use it")
so that priority arguments are optional even when --pid is not specified.
Before this patch:
$ chrt --other ls -lh
chrt: invalid priority argument: 'ls'
-> only "chrt --other 0 ls -lh" would work
After this patch:
$ chrt --other ls -lh
$ chrt --other 0 ls -lh
-> both now work
If an out‑of‑range priority is given, it reports an error:
$ chrt --other 1 ls -lh
unsupported priority value for the policy: 1 (see --max for valid range)
Changes in v2:
- Removed is_number() and used isdigit_string() (Karel Zak)
- used _() for translation (Karel Zak)
Fixes: e7a2d62434c2 ("chrt: Make priority optional for policies that don't use it") Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
tests/helpers/test_sigstate.c: explicitly reset SIGINT to default action after trapping
After upgrading bash to 5.3 to contain commit [1], if SIGINT was trapped in
asynchronous subshell, bash called set_signal_async_ignored to make sure
processes that are created by this asynchronous subshell to ignore SIGINT.
And it caused test case `kill/decode' failed, the signal INT was existed in
both of Blocked and Ignored
Seppo Takalo [Thu, 24 Jul 2025 11:38:59 +0000 (14:38 +0300)]
ldattach: Allow changing the MTU for GSM0710 framing
Traditionally ldattach have hard coded MTU of 127 bytes
which differs from defaults proposed in 3GPP TS 27.010
which is 31 bytes when basic framing is used.
Add '-m <value>' parameter that is only GSM0710 specific
and already handled by the kernel. Use same value for both
MTU and MRU.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Karel Zak [Mon, 28 Jul 2025 09:51:43 +0000 (11:51 +0200)]
Merge branch 'PR/column-colors' of https://github.com/karelzak/util-linux-work
* 'PR/column-colors' of https://github.com/karelzak/util-linux-work:
column: add support for color scheme
libsmartcols: add function to set/get header colors
lib/strutils: add ul_optstr_get_value()
lib/color-names: Fix color name canonicalization
column: add --color[=<when>] to control colorization
column: add basic colors support
Karel Zak [Mon, 21 Jul 2025 06:16:25 +0000 (08:16 +0200)]
setpriv: Improve getgroups() Portability
setpriv(1) is Linux-only, and on Linux, getgroups() returns at least one group.
However, it's better to use more portable and generic code patterns and assume
that getgroups() can return zero.
Fixes: https://github.com/util-linux/util-linux/issues/3654 Reported-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Karel Zak <kzak@redhat.com>
column: call gettext() on an error message only when it gets printed
Just mark error messages for translation, with gettext_noop(), and pass
them untranslated to the subroutines. Then call gettext() on such a
message only when an error occurs and the message gets printed.
The ranges are constructed greedily; in general it is difficult to
construct a minimal list.
% ./taskset -c 0-63:3,0-63:4 ./taskset -pc 0
pid 3926213's current affinity list: 0,3,4-8:2,9-15:3,16-20:2,21-27:3,28-32:2,33-39:3,40-44:2,45
chrt: do not try to interpret any other option as a PID either
When doing, for example, `chrt --pid --max`, it would report:
chrt: invalid PID argument: '--max'
This mistakenly gave the impression that the PID argument has to follow
directly after the --pid option.
Avoid this by delaying the parsing of a PID until after all options have
been parsed. Temporarily set 'ctl->pid' to zero to indicate that a PID
needs to be read.
After this change, `chrt --pid --max` will simply report the minimum and
maximum valid priorities. And `chrt --pid -v`:
chrt: too few arguments
Also, add a missing call of gettext() for the other error message.
chrt: simplify the other check for too few arguments
Without option --pid, always at least two arguments are needed:
the <priority> value and a <command>. (The 'need_prio' variable
is relevant only for the --pid case.)