Kiran Rangoon [Fri, 16 Jan 2026 17:06:48 +0000 (12:06 -0500)]
tests: add tests for unshare --forward-signals
Add two test cases for the new --forward-signals option:
- forward-signals: verifies SIGTERM is forwarded to child
- forward-signals-kill-child: verifies compatibility with --kill-child
Both tests use test_sigreceive which exits with the signal number
received, confirming proper signal forwarding.
Kiran Rangoon [Fri, 16 Jan 2026 17:06:47 +0000 (12:06 -0500)]
unshare: document --forward-signals in man page
Add documentation for the new --forward-signals option, explaining
its use case (graceful shutdown during reboot/system management)
and interaction with the --fork option.
Kiran Rangoon [Fri, 16 Jan 2026 17:06:46 +0000 (12:06 -0500)]
unshare: implement signal forwarding when --forward-signals is used
When --forward-signals is specified, install signal handlers for
SIGTERM and SIGINT that forward these signals to the child process.
This allows child processes with cleanup handlers to execute gracefully during shutdown scenarios like
system reboot.
Also fix waitpid() to handle EINTR properly when signals are being
forwarded, ensuring the parent waits for the child to complete
signal handling before exiting.
Kiran Rangoon [Fri, 16 Jan 2026 17:06:45 +0000 (12:06 -0500)]
unshare: add --forward-signals option to argument parser
Add a new --forward-signals command-line option that will allow
unshare to forward SIGTERM and SIGINT signals from the parent
process to the forked child process.
This commit adds the option parsing infrastructure but does not
implement the signal forwarding logic yet. The flag defaults to 0
(disabled) to maintain backward compatibility.
Karel Zak [Wed, 14 Jan 2026 11:12:35 +0000 (12:12 +0100)]
lib/path: add NULL checks for path in statx and access
Coverity warns that *at() libc functions (faccessat, statx) have pathname
marked as nonnull. Add explicit runtime NULL checks returning -EINVAL
instead of using __attribute__((nonnull)) into include/path.h to maintain
runtime safety for suid code.
Karel Zak [Mon, 12 Jan 2026 15:27:23 +0000 (16:27 +0100)]
blkpr: Call gettext() for descriptions, clean up
* Use N_() and _() macros to translate description texts.
* Avoid repeating command/flag/type names in description texts.
* Remove trailing line breaks; it's the caller's task to format
before/after the descriptions.
* Improve coding style by starting strings at the beginning of the
line, enhancing maintainability (80 characters limit).
* Keep "}, {" on separate lines as per our usual coding practice.
Stefan Hajnoczi [Wed, 17 Dec 2025 18:26:07 +0000 (13:26 -0500)]
blkpr: add read-reservation command
The new IOC_PR_READ_RESERVATION ioctl reports the current reservation on
a device. Add a command so that users can inspect the current
reservation. This is useful both for troubleshooting and for recovery
scenarios.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Stefan Hajnoczi [Wed, 17 Dec 2025 18:26:06 +0000 (13:26 -0500)]
blkpr: add read-keys command
The new IOC_PR_READ_KEYS ioctl lists registered keys on a device. Add a
command so that users can inspect keys. This is useful both for
troubleshooting and for recovery scenarios.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Stefan Hajnoczi [Wed, 17 Dec 2025 18:26:05 +0000 (13:26 -0500)]
blkpr: prepare for _IOR() ioctls
parse_pr_command() returns the ioctl command constant for a given
command or -1 when the command is unknown. Up until now all ioctl
command constants were positive, so the following check worked:
if (command < 0)
err(EXIT_FAILURE, _("unknown command"));
The top two bits of ioctl command constants encode the direction (_IO,
_IOR, _IOW, _IOWR). ioctl commands defined with _IOR have negative ioctl
command constants.
Explicitly check for -1 to differentiate "unknown command" from valid
ioctls commands. Later commits will add ioctl commands that use _IOR.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Karel Zak [Mon, 12 Jan 2026 12:21:32 +0000 (13:21 +0100)]
Merge branch 'lslocks--Q' of https://github.com/masatake/util-linux
* 'lslocks--Q' of https://github.com/masatake/util-linux:
tests: (lslocks) test -Q,--filter option
tests: (test_mkfds::nop) new factory just printing pid
lslocks: special-case PID for filtering (skip −1)
lslocks: make SIZE filterable by normalizing to bytes
lslocks: implement Q, --filter option
lslocks: factor out code getting and setting the data from add_scols_line
lslocks: (refactor) move proc_locks to struct lslocks
lslocks: (refactor) move pid_locks in main to struct lslocks
lslocks: (refactor) move "tab" file static variable to struct lslocks
lslocks: (refactor) add struct lslocks representing the global context
lslocks: (refactor) use global bytes in get_json_type_for_column()
lslocks: (refactor) add a helper function refining value returned from get_lock
lslocks: (refactor) don't use redundant callback functions
lslocks: (refactor) specify list_head as type instead of abusing void*
lslocks: (refactor) use separate function to initialize libscols_table
lslocks: (refactor) remove an unused local variable
lslocks: (refactor) use narrow variable scoping for loop counters
lslocks: (comment) fix grammar
Karel Zak [Mon, 12 Jan 2026 12:21:17 +0000 (13:21 +0100)]
Merge branch 'PR/fallocate-report-holes' of https://github.com/karelzak/util-linux-work
* 'PR/fallocate-report-holes' of https://github.com/karelzak/util-linux-work:
tests: convert fallocate to use subtests
fallocate: refactor --report-holes and --dig-holes output
fallocate: add --report-holes
The existing code tries to only print content of non-empty files, but
does not check the target of an encountered symbolic link, which could
be even something else, e.g. a fifo. Add the missing check to the
motddir_filter function.
Even though alarm(0) is called, another process could still send a
SIGALRM signal to the login process, which could trigger a use after
free for a tiny amount of time.
Not able to reproduce without adding a proper sleep.
The util-linux project preferred coding style is based on the kernel
coding-style (https://docs.kernel.org/process/coding-style.html),
which explains that opening braces should be on a line on their own
after the function signature. Therefore, let us adapt functions that
violate this convention.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Karel Zak [Thu, 8 Jan 2026 12:35:43 +0000 (13:35 +0100)]
Merge branch 'feat/new_tool_getpidino' of https://github.com/cgoesche/util-linux-fork
* 'feat/new_tool_getpidino' of https://github.com/cgoesche/util-linux-fork:
lib: (pidfd-utils) minor correction in the ul_get_valid_pidfd_or_err() description
tests: add getino tests
bash-completion: add getino completions
getino: new tool to print the unique pidfd or namespace inode number
Alessandro Ratti [Sun, 28 Dec 2025 18:12:08 +0000 (19:12 +0100)]
tests: add regression test for repeated termreduce printing
Add a regression test that verifies repeated printing of the same
libsmartcols table produces identical output when termreduce is used.
Before the fix, the effective output width would shrink on each print,
resulting in progressively truncated output. The test guards against
future regressions by ensuring printing remains stable across
invocations.
Add a small test helper program that creates a libsmartcols table,
applies scols_table_reduce_termwidth(), and prints the table multiple
times within the same process.
The helper is used by regression tests to detect unintended cumulative
width reduction across repeated printing.
Alessandro Ratti [Sun, 28 Dec 2025 18:07:55 +0000 (19:07 +0100)]
libsmartcols: avoid cumulative width reduction during printing
__scols_initialize_printing() applied scols_table_reduce_termwidth()
by mutating table->termwidth via scols_table_set_termwidth().
When printing is performed repeatedly on the same table (e.g. in
interactive applications), this causes the effective output width
to shrink on each invocation, eventually truncating output.
Introduce an internally computed effective output width and stop
modifying termwidth during printing. All layout calculations are
updated to use the derived width instead, making the printing path
idempotent.
No functional change is expected for single-shot printing.
Addresses: https://github.com/util-linux/util-linux/issues/3895 Suggested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
ci: add usage message consistency check to CI CODECHECK phase
Add 'make checkmanpage' to the GitHub CI CODECHECK phase.
This ensures that all programs have a corresponding manpage
and that said manpage have a description for each long option
defined in the respective program's source code.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
tools: verify the consistency of manpages for all programs
The tools/checkmanpage.sh script ensures that all programs
have a corresponding manpage as well as the integrity of
all described long options in the manpage based on the
respective programs source code.
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
libblkid: (bcachefs) add members_v2 parsing support
Since bcachefs 1.25, in many cases bcachefs does not write members_v1 field
in the superblock, leading to UUID_SUB and FSSIZE tags missing in blkid output.
Fix this by parsing the new extendable members_v2 superblock field too.
Karel Zak [Tue, 6 Jan 2026 11:27:58 +0000 (12:27 +0100)]
Merge branch 'setpwnam' of https://github.com/stoeckmann/util-linux
* 'setpwnam' of https://github.com/stoeckmann/util-linux:
setpwnam: use getline instead of fgets
setpwnam: only unlock when actually locked
setpwnam: check if /etc/passwd was fully read