Karel Zak [Tue, 13 May 2025 06:09:37 +0000 (08:09 +0200)]
Merge branch 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work
* 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work:
setpriv: follow /etc/login.defs for PATH
su: use logindefs_setenv_path()
login: use logindefs_setenv_path()
logindefs: Add function to set PATH
Karel Zak [Tue, 13 May 2025 06:09:16 +0000 (08:09 +0200)]
Merge branch 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work
* 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work:
setpriv: protect COLORTERM and NO_COLOR env. variables
su: protect COLORTERM and NO_COLOR env. variables
login: protect COLORTERM and NO_COLOR env. variables
Karel Zak [Mon, 5 May 2025 11:10:05 +0000 (13:10 +0200)]
Merge branch 'PR/parse_switch' of https://github.com/karelzak/util-linux-work
* 'PR/parse_switch' of https://github.com/karelzak/util-linux-work:
fix and add parse_switch() test
strutils: move an error message to where it is used, and improve it
irqtop: use standard 'always/never' arguments instead of 'enable/disable'
Karel Zak [Mon, 5 May 2025 11:06:47 +0000 (13:06 +0200)]
Merge branch 'PR/Benno-29Apr' of https://github.com/karelzak/util-linux-work
* 'PR/Benno-29Apr' of https://github.com/karelzak/util-linux-work:
po-man: add hyperlink.adoc to po4a.cfg
docs,usage: harmonize description of --hyperlink, and add 2 missing ones
pipesz: report default size in --help, instead of referring the user
lsfd: improve grammar, and use angular brackets around placeholder word
uuidd: put an option and its description in a single message
pipesz: (man) improve the markup and some wordings
irqtop: make the wording of an error message identical to that of another
unshare: make the wording of a message identical to that of three others
Karel Zak [Mon, 5 May 2025 11:06:23 +0000 (13:06 +0200)]
Merge branch 'PR/hardlink-logging' of https://github.com/karelzak/util-linux-work
* 'PR/hardlink-logging' of https://github.com/karelzak/util-linux-work:
hardlink: define more function as inline
hardlink: fix performance regression (inefficient signal evaluation)
hardlink: Use macro for verbose output
strutils: move an error message to where it is used, and improve it
Calling gettext() is somewhat costly: it has to find the given message
among the more than five thousand messages in util-linux's repertoire.
So, call gettext() only when the message actually gets printed.
Besides, allowing to customize the error message for parse_switch() was
a nice gesture, but it's unneeded: a fixed error message is good enough.
Also, "argument error" was rather vague, as it doesn't say _what_ the
error is. Better say "unsupported argument".
irqtop: use standard 'always/never' arguments instead of 'enable/disable'
Most other util-linux tools that accept the option argument "auto"
additionally accept "always" and "never", not "enable" / "disable".
So, make option --cpu-stat accept those standard words (besides the
deviant ones), and adjust the documentation to use the standard words.
Furthermore, make --cpu-stat accept also "on", "off", "yes", "no",
"1", and "0", to allow the user to use shorter words. The per-CPU
stats can now be suppressed with a succinct: `irqtop -c0`.
CC: Zhenwei Pi <pizhenwei@bytedance.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
lsfd: improve grammar, and use angular brackets around placeholder word
Also, use <list> (the standard way to indicate multiple arguments) as
argument of --pid, and don't use "<when>" when the possible arguments
differ from "always", "never", "auto".
In addition, improve some wording and markup in the man page.
Karel Zak [Tue, 29 Apr 2025 10:29:32 +0000 (12:29 +0200)]
hardlink: fix performance regression (inefficient signal evaluation)
During work on better verbose output, I found a regression between
v2.40 and v2.41 (and v2.42). In the new version, hardlink is 3-4 times
slower.
The problem is in the function where we verify signals. It calls the
function signal() even though no signal is delivered. It's called in
code loops where hardlink scans files, making it a performance-sensitive
area.
Another significant performance improvement is using an inline function
for handle_interrupt().
This simple patch improves hardlink performance by 10 times.
Fixes: http://github.com/util-linux/util-linux/commit/1453200e22dd4ec858be027653c167225f2fb358 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 29 Apr 2025 09:49:23 +0000 (11:49 +0200)]
hardlink: Use macro for verbose output
Now that jlog() is a function, all gettext() arguments are evaluated
in all cases, including when output is unnecessary due to --quiet or
low verbose mode.
Fixes: https://github.com/util-linux/util-linux/issues/3548 Signed-off-by: Karel Zak <kzak@redhat.com>
OpenWRT has SDKs targetting MIPS 32/64 bit, little/big endian.
Currently util-linux CI only uses 32 bit little endian through ath79.
Add a big-endian 64bit and little-endian 32bit architecture, too.
Karel Zak [Fri, 25 Apr 2025 08:39:59 +0000 (10:39 +0200)]
Merge branch 'PR/statmount-cleanup' of https://github.com/karelzak/util-linux-work
* 'PR/statmount-cleanup' of https://github.com/karelzak/util-linux-work:
libmount: use and add has_listmount()
libmount: avoid calling memset() unnecessarily
libmount: clean up statmount syscall-related functions
Karel Zak [Thu, 24 Apr 2025 16:16:07 +0000 (18:16 +0200)]
libmount: clean up statmount syscall-related functions
* Rename the raw version of the syscall from ul_statmount() to
ul_statmount_syscall().
* Rename `sys_statmount()` to `ul_statmount()`. The goal is to use the
same naming convention as `ul_listmount()` for a function that is
expected to be called from code.
* Move ul_statmount() to be in the same #ifdef block as the rest of
the statmount code in the header file.
* Add has_statmount() to make it easy to verify the usability of the
statmount syscall.
lscpu: (man) don't refer to a missing section, and improve some wordings
Three years ago commit aa049eabb3 removed the COLUMNS section but forgot
to remove the reference to it. Replace the reference with a referral to
the --help text.
In the bargain, join two paragraphs that belong together, improve some
wordings, and sort two options.
renice: in usage text, condense the oververbose description of option -n
The --help text should be concise: it serves only as a reminder of how
things work. When a more wordy explanation is needed, there is always
the man page (as every --help text says at the end).
CC: David Anes <david.anes@suse.com> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
terminal-colors.d: (man) reduce two tables to succinct lists
Before the move to asciidoctor, these tables were succinct lists in the
man page. Change the asciidoc text to make them into lists again.
Use {nbsp} on one line to avoid weird groff behavior for \? when .ss
is defined to be zero-width (as asciidoctor does), and reshuffle two
paragraphs to avoid an asciidoctor bug that adds a spurious \fP after
a monospace span defined with double backticks.
Also, correct some markup in a few earlier paragraphs.
rtcwake: (man) reduce an inflated table to sane proportions
Asciidoctor puts an unneeded blank line into every table cell (this
is fixed in git [1], but not released yet), and will unnecessarily
wrap text in a cell when the text is slightly longer than average.
Replace the table with a block of preformatted text, and replace
the "+5min" example with a true format that covers most cases,
and give some examples of that format after the block.
last: (man) reduce an inflated table to sane proportions
Also, reword some things for better flow, improve some markup, and
combine username and tty to [username|tty]... in the synopsis, as
this better indicates that the two identifiers can be mixed.
Furthermore, use quotes around the time formats that contain a space,
as otherwise the time would be understood as a user name / tty name.
Drop the "tomorrow" and "+5min" examples, as they don't make sense
here. And change the "-5days" example to a true format that covers
most possibilities, and give a few examples of it after the table.
last: (man) correct the descriptions of --present and --since
Doing `last --present -24h` will show who was logged in around this time
yesterday. But when doing (what according to the man page is equivalent)
`last --since -24h --until -24h` nothing will be shown -- unless someone
logged in exactly 24 hours ago to the second.
So, correct the descriptions of --present and --since.
This fixes #1896 (https://github.com/util-linux/util-linux/issues/1896). Reported-by: Finn Krein-Schuch Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
bits: (man) normalize the markup and improve some layout
The convention in man pages is: to put command arguments in lowercase
and without angle brackets (these are for --help texts), and without
unneeded abbreviations. Literal values (as in some examples) should
be in bold, not in italics.
CC: Robin Jarry <robin@jarry.cc> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl> Reviewed-by: Robin Jarry <robin@jarry.cc>
Karel Zak [Tue, 22 Apr 2025 10:21:59 +0000 (12:21 +0200)]
Merge branch 'losetup/udev' of https://github.com/t-8ch/util-linux
* 'losetup/udev' of https://github.com/t-8ch/util-linux:
lib/loopdev: open loop control device read-only if possible
lib/loopdev: clarify comment about device and backing file modes
lib/loopdev: remove loopcxt_set_fd()
Thomas Weißschuh [Sat, 19 Apr 2025 20:02:11 +0000 (22:02 +0200)]
include/mount-api-utils: include linux/unistd.h
If SYS_statmount/SYS_listmount is not provided by the libc,
util-linux will fall back to __NR_statmount/__NR_listmount from the
kernel UAPI headers.
However it is not guaranteed that these symbols are actually visible in
mount-api-utils.
Include linux/unistd.h which provides syscall numbers.
While this header is specific to Linux, the code is already using
linux/mount.h.
Karel Zak [Wed, 16 Apr 2025 11:21:47 +0000 (13:21 +0200)]
Merge branch 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work
* 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work:
libmount: (subdir) support detached open_tree() (>=6.15)
libmount: (subdir) restrict for real mounts only
libmount: (subdir) remove unused code
Thomas Weißschuh [Wed, 16 Apr 2025 09:55:31 +0000 (11:55 +0200)]
lib/loopdev: open loop control device read-only if possible
Opening the control device read-write to trigger udev events is a hack.
It works around a kernel bug which fails to send uevents directly from the
kernel by triggering a full udev reprobe.
While it works to trigger the events, it is problematic.
The udev reprobe will asynchronously recreate all partition devices which
requires an ungly locking and synchronization scheme after losetup has
completed to guarantee the usability of the partition devices.
The kernel has been fixed to properly emit these uevents in
commit 7ed2a771b5fb ("loop: properly send KOBJ_CHANGED uevent for disk device").
Drop the workaround.
This is a partial revert of
commit ced1142d6f25 ("losetup: cleanup device node modes").
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Karel Zak [Tue, 15 Apr 2025 10:29:37 +0000 (12:29 +0200)]
libmount: (subdir) support detached open_tree() (>=6.15)
The latest kernel can open a directory as a tree (open_tree()) on a
detached mount tree. This means we do not need to unshare and
attach the root of the filesystem to a private temporary directory. All
this machinery can be replaced by one open_tree() call.
Note that this commit does not completely deactivate hook_subdir.c
because it is better to keep things in one place. It only adds a "subdir"
to the struct libmnt_sysapi to force hook_mount.c to call open_tree(subdir),
but all the logic and checks are still in hook_subdir.c.
setarch: (man) correct the markup of the synopsis and of two options
Drop the second line of the synopsis as it is unneeded (it is covered
by the first line since argument "arch" became optional) and distracts
from the similarity/contrast between the other two lines.
Mark "arch" in the new second synopsis line in italics, as it is a
placeholder, not a literal.
Also, improve some wording, reduce redundancy by reshuffling the --pid
option, and remove a redudant -v from an example.
Karel Zak [Wed, 16 Apr 2025 08:17:49 +0000 (10:17 +0200)]
Merge branch 'PR/Benno-14Apr' of https://github.com/karelzak/util-linux-work
* 'PR/Benno-14Apr' of https://github.com/karelzak/util-linux-work:
lastlog2: besides -v, recognize also the standard -V for --version
lastlog2: (man) fix some broken markup, and lowercase option arguments
docs: add -h/--help and -V/--version to three man pages that lacked them
losetup,lscpu: (man) add the missing -h/--help and -V/--version options
agetty,setterm: (man) remove the mistakenly added -h and -V short options
docs: fix a few indentation issues
docs: improve and harmonize the description of -H / --list-columns
docs: rewrite the description of --bytes, to be clearer
Martin Valgur [Tue, 15 Apr 2025 13:19:21 +0000 (16:19 +0300)]
meson: fix a bug in posixipc_libs configuration
Should append instead of assigning. Otherwise fails with
meson.build:1482:22: ERROR: Object <[ExternalLibraryHolder] holds [ExternalLibrary]: <ExternalLibrary rt: True>> of type ExternalLibrary does not support the `+` operator.
agetty,setterm: (man) remove the mistakenly added -h and -V short options
Three years ago, commit 2b2d317242 was a little overzealous and replaced
also occurrences of --help and --version that were *not* paired with -h
and -V: `agetty` does not know -V and uses -h for something else, and
`setterm` does not know any short options at all.
Karel Zak [Tue, 15 Apr 2025 10:48:32 +0000 (12:48 +0200)]
Merge branch 'meson-fixes' of https://github.com/t-8ch/util-linux
* 'meson-fixes' of https://github.com/t-8ch/util-linux:
meson: use .to_string() in configuration data check
meson: add feature for translated documentation
meson: remove tinfo dependency from 'more'
Using strerror is not safe in shared libraries as it is unknown
what the calling apps may do with the storage behind the scenes.
Using %m is ok, except in contexts that need to be as-safe.
Karel Zak [Tue, 8 Apr 2025 11:41:11 +0000 (13:41 +0200)]
Merge branch 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work
* 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work:
zramctl: (man) mention the required arguments for -p and -r
zramctl: restore normal description indentations in the usage text
textual: fix a mistruncated message, and fix a typo
hwclock: remove two comments about parameters that no longer exist
mount: (man) shorten an overlong line, and improve some markup
Also, in the synopis mention -F separately to make it more obvious that
it applies only to -A, swap two options to make a line more similar to
the preceding one, and improve some wording.