Karel Zak [Wed, 20 Jul 2022 13:23:01 +0000 (15:23 +0200)]
lib/fileutils: fix compiler warning
lib/fileutils.c: In function ‘dup_fd_cloexec’:
lib/fileutils.c:75:35: warning: unused parameter ‘lowfd’ [-Wunused-parameter]
int dup_fd_cloexec(int oldfd, int lowfd)
^
Addresses: https://github.com/util-linux/util-linux/issues/1755 Signed-off-by: Karel Zak <kzak@redhat.com>
Sol Boucher [Fri, 8 Jul 2022 16:09:13 +0000 (12:09 -0400)]
unshare: Fix "you (user xxxx) don't exist" error when uid differs from primary gid
This problem affected the --map-auto and --map-groups=auto command-line switches.
The root cause is that /etc/subgid is indexed by user or uid, not by group or gid;
therefore, we should be using the effective uid to find entries in this file, just
as we do for /etc/subuid.
Will Jordan [Wed, 22 Jun 2022 22:13:11 +0000 (15:13 -0700)]
Improve is_dm_leaf performance
Read from `/holders` instead of `/slaves` to determine
whether the device is a leaf node, eliminating a scan
across all block devices in the system.
Karel Zak [Tue, 7 Jun 2022 07:11:56 +0000 (09:11 +0200)]
lslogins: improve prefixes interpretation
It seems that for example 'passwd --lock' uses two exclamation marks
in password field. It seems better to assume arbitrary number of '!'
and '*' prefixes.
The patch also makes description of the PWD-EMPTY output field more
explicit.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2093166 Signed-off-by: Karel Zak <kzak@redhat.com>
The name BLOCK_SIZE is unfortunate. This tag doesn't represent
commonly used file system block size but minimal block size
accessible by file system (sector size).
Hideki EIRAKU [Wed, 25 May 2022 03:23:16 +0000 (12:23 +0900)]
loopdev: set block_size when using LOOP_CONFIGURE
LOOP_CONFIGURE ioctl was introduced by commit d5fd456c88aba4fcf77d35fe38024a8d5c814686. Since the previous
implementation set partscan flag but did not set block_size with the
LOOP_CONFIGURE ioctl, an issue fixed by commit 422f0e9f206a145c59a71333dad20d38cbbfc0c4 was reappeared. Setting
block_size in the LOOP_CONFIGURE ioctl parameter fixes the issue.
Signed-off-by: Hideki EIRAKU <hdk@igel.co.jp> Signed-off-by: Karel Zak <kzak@redhat.com>
csbo98 [Sun, 22 May 2022 06:47:13 +0000 (14:47 +0800)]
taskset: fix use of err_affinity()
Maybe there is a little mistake in do_taskset() function in taskset.c.
In the first call of sched_getaffinity(), if the call is failed we should
use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1).
Scott Shambarger [Thu, 12 May 2022 23:27:26 +0000 (16:27 -0700)]
fstrim: Remove all skipped entries before de-duplication
When processing fstab entries, de-duplication is performed based on the
source before all tests on the target have been checked, resulting in
some entries being skipped when a removed duplicate with a different
target would not have been.
The fix is to move all the target checks before the source
de-duplication.
Addresses: #1686 Signed-off-by: Scott Shambarger <devel@shambarger.net>
Karel Zak [Mon, 2 May 2022 10:57:13 +0000 (12:57 +0200)]
more: avoid infinite loop on --squeeze
The command 'echo | more -s' ends in infinite loop if exit-on-EOF is
disabled (default now). We need to call more_key_command() to ask for
user's reaction.
Fixes: https://github.com/util-linux/util-linux/issues/1669 Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk: (gpt) Add UUID for Marvell Armada 3700 Boot partition
This GPT UUID is used by BootROM on Marvell Armada 3700 SoC. BootROM
searches for GPT partition with this UUID on attached SATA disk and loads
bootloader from it.
Marvell Armada 3700 SoC is used e.g. on popular EspressoBIN SBC board which
has relatively solid Linux support.
Information about SATA booting and this GPT partition is currently
documented only in development version of ARM Trusted-Firmware-A
documentation:
Warner Losh [Fri, 29 Apr 2022 21:29:44 +0000 (15:29 -0600)]
BSD: Use byteswap.h and endian.h defined macos when present
Newer versions of FreeBSD will have a glibc compatible
byteswap.h. Currently, this file assumes that FreeBSD requires
bswap{16,32,64} to always be defined. This isn't the case when we're
using the byteswap.h file (which is enabled by HAVE_BYTESWAP_H
define). Assume that if byteswap.h and endian.h are present, then the
proper macros are defined. Otherwise, assume that sys/endian.h is
present and paper over the small differences between the BSDs for this
file.
libmount: when moving a mount point, all sub mount entries in utab should also be updated
Given that /run/mount/utab stores paths, this file needs to be adjusted when a
mount tree is moved.
However the moved tree may contains sub mount points in which case their utab
entries (if any) need to also be translated.
This patch takes care of that.
As suggested in https://github.com/systemd/systemd/issues/15266, a better
approach might be to store mount IDs instead of paths since mount IDs remain
unchanged when mount trees are moved.
Karel Zak [Wed, 20 Apr 2022 12:42:32 +0000 (14:42 +0200)]
dmesg: fix --since and --until
Now --since and --until requires any time field in the output (e.g.
--ctime,-T), it means "dmesg --since '1 day ago'" doesn't work, but
"dmesg -T --since '1 day ago'" works as expected.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2076829 Signed-off-by: Karel Zak <kzak@redhat.com>
lsns unconditionally uses NS_GET_NSTYPE since version 2.38 and
https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/?id=de72df79d72fa906e71e2ac922d8745ff22deee5
which is only available since kernel 4.11 and
https://github.com/torvalds/linux/commit/e5ff5ce6e20ee22511398bb31fb912466cf82a36
resulting in the following build failure:
sys-utils/lsns.c: In function 'add_namespace_for_nsfd':
sys-utils/lsns.c:719:25: error: 'NS_GET_NSTYPE' undeclared (first use in this function)
719 | clone_type = ioctl(fd, NS_GET_NSTYPE);
| ^~~~~~~~~~~~~
So add an option to allow the user to disable lsns
Karel Zak [Mon, 4 Apr 2022 13:59:36 +0000 (15:59 +0200)]
tests: make libmount tests more portable
git tree on macbook:
...
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:
Stanislav Brabec [Fri, 25 Mar 2022 08:26:48 +0000 (09:26 +0100)]
flock: Decribe limitations of flock: deadlock, NFS, CIFS
The flock(1) does not refer to limitations of flock(2). Provide an
documentation entry point for solving of problems with flock on NFS
and CIFS and mention risk of deadlock.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>