Karel Zak [Tue, 2 Apr 2024 10:58:02 +0000 (12:58 +0200)]
Merge branch 'lsns--Q' of https://github.com/masatake/util-linux
* 'lsns--Q' of https://github.com/masatake/util-linux:
tests: (lsns) add a case testing -Q, --filter option
tests: (test_mkfds::userns) add a new factory
tests: (test_mkfds::multiplexing) fix the factory description
lsns: add -H, --list-columns option
lsns: implement -Q, --filter option
lsfd: (man) fix the decoration of an optional parameter
lsns: add a missing '=' character in the help message
lsns: (man) make the namespace parameter optional
lsblk: (refactor) refer to a parameter instead of a file static var
Jordan Williams [Fri, 29 Mar 2024 19:00:01 +0000 (14:00 -0500)]
meson: Fix false positive detection of mempcpy on macOS
The has_function check incorrectly detects mempcpy on macOS.
This function is not available on macOS and should not be detected.
Likely, this has to do with Meson's detection of compiler built-ins.
Using a specific prefix and defining _GNU_SOURCE fixes the detection.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Mon, 1 Apr 2024 10:14:50 +0000 (12:14 +0200)]
libblkid: Fix segfault when blkid.conf doesn't exist
* Move 'line' and 'uevent' to the beginning of the LIBECONF code.
* Remove unwanted space between function name and arguments.
* Check for 'line' pointer before dereferencing.
References: https://github.com/util-linux/util-linux/pull/2883 Signed-off-by: Karel Zak <kzak@redhat.com>
Jordan Williams [Fri, 29 Mar 2024 21:56:43 +0000 (16:56 -0500)]
meson: Don't define HAVE_ENVIRON_DECL when environ is unavailable
HAVE_ENVIRON_DECL is being defined to 0 by cfg_data.set10().
The code only checks whether or not is defined.
This leads to it not being declared appropriately.
Use cfg_data.set() instead of cfg_data.set10() to define it when true.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Karel Zak [Wed, 27 Mar 2024 10:46:01 +0000 (11:46 +0100)]
Merge branch 'blkid/json' of https://github.com/t-8ch/util-linux
* 'blkid/json' of https://github.com/t-8ch/util-linux:
blkid: add json output format
blkid: (tests) test output formats
blkid: (tests) use correct blkid binary
Karel Zak [Tue, 26 Mar 2024 11:45:24 +0000 (12:45 +0100)]
lsipc: fix semaphore USED counter
The code incorrectly counts only with the first item in the linked
list (due to a typo). It seems rather fragile to use "semds" and
"semdsp" as variable names in the same code ...
# lsipc -gs
Old:
KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION LIMIT USED USE%
SEMMNI Number of semaphore identifiers 32000 3 0.01%
SEMMNS Total number of semaphores 1024000000 369 0.00%
SEMMSL Max semaphores per semaphore set. 32000 - -
SEMOPM Max number of operations per semop(2) 500 - -
SEMVMX Semaphore max value 32767 - -
Fixed:
KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION LIMIT USED USE%
SEMMNI Number of semaphore identifiers 32000 3 0.01%
SEMMNS Total number of semaphores 1024000000 156 0.00%
SEMMSL Max semaphores per semaphore set. 32000 - -
SEMOPM Max number of operations per semop(2) 500 - -
SEMVMX Semaphore max value 32767 - -
Addresses: https://issues.redhat.com/browse/RHEL-30269 Signed-off-by: Karel Zak <kzak@redhat.com>
Tim Hallmann [Sun, 24 Mar 2024 19:14:30 +0000 (20:14 +0100)]
rev: Check for wchar conversion errors
Commit c9cc84621ca98ef85499e83ca56f05f12055f193 introduced a regression
where only the actual EOF is handled, not other error conditions
returning WEOF. This leads to an infinite loop upon encountering
conversion errors. For example (using LC_CTYPE="en_US.UTF-8"):
Jordan Williams [Wed, 20 Mar 2024 16:41:49 +0000 (11:41 -0500)]
meson: Only build blkzone and blkpr if the required linux header exists
Checks for the required headers for blkzone and blkptr are done for
Autotools.
This logic wasn't carried over to Meson.
This PR just adds the same checks.
Fixes #2850.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
The blamed commit converted script to use the generic pty code that
was added by commit 6954895cae34 ("lib/pty-session: add generic PTY
container code").
Commit ec10634e7ec4 says the new pty stuff is based on script.
However, there is difference in signal handling.
Before the commit, only the signals that the script was interested
in were blocked and handled by signalfd.
After the commit, all signals are blocked and only the interested
signals are handled.
This causes regression in the following scenario:
1. run `script` via /etc/profile.d for ssh session
2. login to a ssh session using bash
3. run `sudo -i`
4. wait until ssh session timeout
Karel Zak [Tue, 5 Mar 2024 09:14:08 +0000 (10:14 +0100)]
Merge branch 'blockdev' of https://github.com/EvgeniyRogov/util-linux
* 'blockdev' of https://github.com/EvgeniyRogov/util-linux:
- Fixed report error code in blockdev. - Minor: Added a period at the end of "--rereadpt" description.
Karel Zak [Mon, 4 Mar 2024 11:38:35 +0000 (12:38 +0100)]
Merge branch 'lsfd--github-issue-2819' of https://github.com/masatake/util-linux
* 'lsfd--github-issue-2819' of https://github.com/masatake/util-linux:
tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point
Stanislav Brabec [Wed, 28 Feb 2024 14:06:14 +0000 (15:06 +0100)]
setterm: Document behavior of redirection
Debugging an error of setterm, I realized that setterm --powerdown operates
on stdout but setterm --powersave operates on stdin. Such unexpected
behavior should be documented.
I prefer a less accurate generic "always redirect both stdin and stdout"
over recommending of the correct I/O stream for each option separately.
Karel Zak [Thu, 29 Feb 2024 08:50:59 +0000 (09:50 +0100)]
Merge branch 'lsfd--btrfs' of https://github.com/masatake/util-linux
* 'lsfd--btrfs' of https://github.com/masatake/util-linux:
tests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output
lsfd: extend nodev table to decode "btrfs" on SOURCE column
lsfd: (refactor) rename a member of struct proc
lsfd: (refactor) rename a local variable and a parameter
lsfd: (refactor) split the function processing mountinfo file
lsfd: (refactor) store a mnt_namespace object to struct process
lsfd: (refactor) use a binary tree as the implementation for mnt_namespaces
lsfd: read /proc/$pid/ns/mnt earlier
lsfd: (refactor) rename add_nodevs to read_mountinfo
lsfd: make the way to read /proc/$pid/mountinfo robust
lsfd: (cosmetic) normalize whitespaces
Karel Zak [Tue, 27 Feb 2024 17:38:02 +0000 (18:38 +0100)]
hexdump: check blocksize when display data
hexdump(1) stores input to buffer and apply format unit when prints
the output. The unit can move pointer which points to the buffer, but
code does not check for limits.
Fixes: https://github.com/util-linux/util-linux/issues/2806 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 26 Feb 2024 11:44:10 +0000 (12:44 +0100)]
libmount: report kernel message from new API
This is a very minimalistic implementation for v2.40 designed to print
error messages from the kernel. It exclusively displays errors, and
the patch does not introduce any new library interface for this
purpose. Instead, it simply replaces hardcoded messages within
libmount with kernel messages.
It's worth noting that the final implementation will necessitate
per-hook error handling in libmount and likely a new library API to
access other types of messages (warnings, notices, etc.).
Jan Kara [Wed, 21 Feb 2024 17:30:50 +0000 (18:30 +0100)]
libmount: don't hold write fd to mounted device
Avoid holding writeable fd to a loop device that is being mounted. In
the hardened configurations (CONFIG_BLK_DEV_WRITE_MOUNTED = n) the
kernel wants to make sure nobody else has the block device writeably
open when mounting so this makes the mount fail.
Reported-by: JunChao Sun <sunjunchao2870@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Christian Brauner <brauner@kernel.org>