- Remove extra newline in errx messages
- Use fprintf/exit for usage to avoid repeated program name
- Improve signal safety by using appropriate functions
This code is not installed, thus no functional change in final
installation of util-linux.
Karel Zak [Tue, 21 Apr 2026 11:15:38 +0000 (13:15 +0200)]
Merge branch 'fallocate_checks' of https://github.com/stoeckmann/util-linux
* 'fallocate_checks' of https://github.com/stoeckmann/util-linux:
fallocate: Add range check
fallocate: Improve argument range check
fallocate: Use off_t instead of loff_t
fallocate: Remove outdated copyright statement
fallocate: Use correct formatters and casts
Cast off_t for F_ADDRESS to long long. In most cases, this should be
actually unsigned long long due to %llx or %llo, but since %lld is also
available and off_t is signed, keep it at that.
In theory, this might fix very intelligent static analysers which notice
that off_t is long int but %ll expects long long, but in reality, this
fixes 32 bit off_t builds. Without this, wrong addresses are shown.
Eventually, the loff_t values are used as arguments for functions which
expect an off_t. Use off_t directly and, while at it, introduce a proper
range check in cvtnum.
Check st.st_size (off_t) for actual file size instead of the possibly
already truncated entry->size (unsigned int) value. Otherwise files
larger than 4 GB might be silently truncated.
libblkid: introduce sysfs_devno_is_dm_hidden() for pre-open check
Stratis reuses the DM "private" UUID convention ("stratis-1-private")
but its devices are legitimately opened by tools like mkfs.xfs to
obtain device geometry. The pre-open check added in the previous
commit (d05a84b22) used sysfs_devno_is_dm_private() which also
blocks Stratis devices, breaking mkfs.xfs on Stratis pools.
Introduce sysfs_devno_is_dm_hidden() which only checks for LVM
internal devices (the "LVM-<uuid>-<name>" UUID pattern). A "hidden"
DM device is one that exists solely as a building block for another
DM target -- no user-space tool should normally open or write to it.
Use sysfs_devno_is_dm_hidden() in blkid_new_probe_from_filename()
so that Stratis devices remain accessible while LVM internal devices
are still skipped before open().
Karel Zak [Thu, 16 Apr 2026 12:59:33 +0000 (14:59 +0200)]
Merge branch 'copyfilerange_syscall_fallback' of https://github.com/cgoesche/util-linux-fork
* 'copyfilerange_syscall_fallback' of https://github.com/cgoesche/util-linux-fork:
build: (copyfilerange) include syscall header check for fallback
style: (misc-utils/copyfilerange.c) fix indentation
include: (fileutils.h) add fallback for the copy_file_range syscall
Karel Zak [Thu, 16 Apr 2026 12:25:14 +0000 (14:25 +0200)]
nsenter: update shell selection documentation
Update DESCRIPTION and add ENVIRONMENT section with SHELL entry,
documenting that when $SHELL is not set, the shell from the user's
passwd(5) entry is used before falling back to /bin/sh.
Addresses: https://github.com/util-linux/util-linux/issues/4242 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 16 Apr 2026 12:25:10 +0000 (14:25 +0200)]
unshare: update shell selection documentation
Update DESCRIPTION and add ENVIRONMENT section with SHELL entry,
documenting that when $SHELL is not set, the shell from the user's
passwd(5) entry is used before falling back to /bin/sh.
Addresses: https://github.com/util-linux/util-linux/issues/4242 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 16 Apr 2026 12:25:03 +0000 (14:25 +0200)]
flock: document shell selection in man page
Add ENVIRONMENT section with SHELL entry, documenting that flock uses
$SHELL with fallback to /bin/sh for non-interactive -c command
execution. The user's passwd(5) shell is not consulted.
Addresses: https://github.com/util-linux/util-linux/issues/4242 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 16 Apr 2026 12:24:42 +0000 (14:24 +0200)]
scriptlive: update shell selection documentation
Document that when $SHELL is not set, the shell from the user's
passwd(5) entry is used before falling back to /bin/sh. Add missing
SHELL entry to the ENVIRONMENT section.
Addresses: https://github.com/util-linux/util-linux/issues/4242 Signed-off-by: Karel Zak <kzak@redhat.com>
flock: re-enable the initial shell selection logic
Commit 6651ae5 added /etc/passwd to the list of shells
to choose from before falling back to _PATH_BSHELL.
This introduced a regression as some tools dont expect
this behavior and assume that unsetting SHELLS is enough.
To re-establish the old behavior we can pass the UL_SHELL_NOPWD
flag to the ul_default_shell() helper to ignore shells in
/etc/passwd.
Addresses: #4242 Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Karel Zak [Wed, 15 Apr 2026 11:53:09 +0000 (13:53 +0200)]
Merge branch 'PR/irqtop-slang-vw_printw' of https://github.com/karelzak/util-linux-work
* 'PR/irqtop-slang-vw_printw' of https://github.com/karelzak/util-linux-work:
irqtop: use irqtop_puts() for pre-formatted table data
irqtop: add vw_printw() fallback for slang builds
Karel Zak [Wed, 15 Apr 2026 11:32:52 +0000 (13:32 +0200)]
Merge branch 'randutils' of https://github.com/stoeckmann/util-linux
* 'randutils' of https://github.com/stoeckmann/util-linux:
randutils: Move comment to correct place
randutils: Keep track of randomness source
randutils: Reduce function and macro visibility
randutils: Remove unused rand_get_number
Karel Zak [Wed, 15 Apr 2026 11:07:05 +0000 (13:07 +0200)]
Merge branch 'printf-integers' of https://github.com/t-8ch/util-linux
* 'printf-integers' of https://github.com/t-8ch/util-linux:
fdisk: use the correct format specifiers for integer types
lib/procfs: return uint64_t from procfs_process_get_stat_nth()
chrt: pass correct integer types to printf
hardlink: avoid format string error for dev_t
strutils: fix printf formats
Karel Zak [Wed, 15 Apr 2026 11:01:36 +0000 (13:01 +0200)]
Merge branch 'kill_decode_test_known_fail' of https://github.com/cgoesche/util-linux-fork
* 'kill_decode_test_known_fail' of https://github.com/cgoesche/util-linux-fork:
tests: (kill/decode) mark test as known-fail for inconsistent s390x/QEMU instances
Karel Zak [Wed, 15 Apr 2026 10:37:38 +0000 (12:37 +0200)]
Merge branch 'ci/meson' of https://github.com/t-8ch/util-linux
* 'ci/meson' of https://github.com/t-8ch/util-linux:
ci: drop dependency from meson to autotools jobs
ci: run CHECK phase for meson
ci: run 'make checkusage' only for autotools build
meson: build test_scols_termreduce
The mcookie utility wants to report the source of randomness, but even
prints getrandom if it failed to retrieve data through it.
Fix this modifying the return data type of ul_random_get_bytes. Instead
of returning a boolean, the actual source is returned. This avoids any
potential TOCTOU or erroneous output.
Karel Zak [Wed, 15 Apr 2026 09:09:59 +0000 (11:09 +0200)]
Merge branch 'newgrp_less_confusing_error_message' of https://github.com/cgoesche/util-linux-fork
* 'newgrp_less_confusing_error_message' of https://github.com/cgoesche/util-linux-fork:
treewide: use err() instead of errx() where ul_get{userpw,grp}_str() fails
lib: (pwdutils.c) improve error return protocol for callers
Karel Zak [Wed, 15 Apr 2026 08:41:57 +0000 (10:41 +0200)]
Merge branch 'unshare_clear_environ' of https://github.com/cgoesche/util-linux-fork
* 'unshare_clear_environ' of https://github.com/cgoesche/util-linux-fork:
nsenter: use clearenv() only when it is available
tests: (unshare) add --clear-env option tests
tests: (test_strerror.c) use ARRAY_SIZE for better readability/portability
tests: (test_strerror.c) add EPERM errno support
bash-completion: (unshare) add --clear-env option
unshare: (manpage) fix minor typos
unshare: new option to prevent environment variable inheritance
The -z argument is only used for parsing without any modification of the
input string. Skip the duplication to fix memory leaks if -z is supplied
multiple times.
The -r arguments are collected in range_files array, which contains
strings which are used for opening files and error messages. Remove
duplication which simplifies memory handling and reduces binary size.
Supplying -s multiple times leaks memory. The given optarg is
eventually set in a struct passwd and line 1657 is the only alternative
that sets a constant string, i.e. the data is neither freed nor
modified.
Fix potential memory leaks and clarify that content of these strings
is never modified. Won't happen since this is test code, but adjust it
for completeness.
The -f arguments are collected in files array, which contains strings
which are used for opening files and error messages. Remove duplication
which simplifies memory handling and reduces binary size.
Thomas Weißschuh [Sun, 12 Apr 2026 06:08:26 +0000 (08:08 +0200)]
lib/procfs: return uint64_t from procfs_process_get_stat_nth()
This functions uses ul_strtoul64() to parse the number. As indicated by
the name that can only handle uint64_t values. Passing it a pointer to
uintmax_t can produce a compiler warning.