Dmitry V. Levin [Sun, 11 Aug 2024 08:00:00 +0000 (08:00 +0000)]
meson: use a / b instead of join_paths(a, b)
According to [1], since meson 0.49.0, using the / operator on strings
is equivalent to calling join_paths().
As the expressions written using the / operator are shorter and nicer
than their equivalents written using join_paths(), and given that
we've been using this new operator since commit 5f2c862a4aff19f5bc732e677405f04e2d07c211, let's convert remaining
join_paths() invocations to use the / operator instead.
John Keeping [Tue, 6 Aug 2024 17:17:29 +0000 (18:17 +0100)]
libmount: propagate first error of multiple filesystem types
Use the same error handling logic as do_mount_by_pattern() to better
handle the case where EROFS is returned from the first filesystem in a
list but subsequent filesystems overwrite this status with, for example,
ENODEV.
This allows read-only devices to mount without the user needing to
explicitly specify "ro" while specifying a list of potential
filesystems, some of which may not be available.
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
John Keeping [Tue, 6 Aug 2024 17:16:00 +0000 (18:16 +0100)]
libmount: extract common error handling function
Extract the logic for whether to continue trying more filesystem types
to a function so that it can be reused to make this consistent between
do_mount_by_pattern() and do_mount_by_types().
Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
lscpu: Skip aarch64 decode path for rest of the architectures
lscpu behaves differently when run sudo vs non-sudo on AMD architectures.
On sudo runs, it adds a BIOS model name and BIOS CPU family which it
does not add for the latter. However since this parsing from the DMI is
primarily catered to aarch64, for AMD platform the BIOS model name is
printed out as follows "AMD XXX Processor *Unknown* CPU @ X.XGHz" due
to the part number is not populated on the platform.
The issue boils down to an unconditional call to arm_decode() which
attempts to read the DMI path and populate the processor information
such as processor version and part number which is set to Unknown on AMD
CPUs.
81d6de9 (lscpu: remove the old code) changed the DMI path from
/sys/firmware/dmi/entries/4-0/raw (non-existent) to
/sys/firmware/dmi/tables/dmi (existent) which has brought this latent
issue to light as DMI was starting to be parsed incorrectly.
Therefore, do not perform aarch64 parsing for other architectures.
Before
------
$ lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
$ sudo lscpu
Vendor ID: AuthenticAMD
BIOS Vendor ID: Advanced Micro Devices, Inc.
Model name: AMD EPYC XXXX X-Core Processor
BIOS Model name: AMD EPYC XXXX X-Core Processor Unknown CPU @ X.XGHz
BIOS CPU family: 107
CPU family: 26
After
-----
$ lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
$ sudo lscpu
Vendor ID: AuthenticAMD
Model name: AMD EPYC XXXX X-Core Processor
CPU family: 26
Fixes: 81d6de9 ("lscpu: remove the old code") Co-developed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@amd.com>
Stanislav Brabec [Sun, 21 Jul 2024 13:01:42 +0000 (15:01 +0200)]
agetty: Prevent cursor escape
Starting with 5de97519, it is possible to escape the login dialog on the
screen by arrow characters or using escape sequences.
Since full processing of escape sequences and ignore them would be
complicated, use a work around: instead of sending ESC to output, send a
printable character.
It could cause a rendering regression in a very obscure condition: compiled
without IUTF8, encoding is ISO-11548-1 and BRAILLE PATTERN DOTS-1245 is
part of login name. I believe that it is out of supported combinations.
Karel Zak [Mon, 15 Jul 2024 10:15:28 +0000 (12:15 +0200)]
Merge branch 'kill--decode' of https://github.com/masatake/util-linux
* 'kill--decode' of https://github.com/masatake/util-linux:
kill: (test) add a case for testing -l 0xSIGMASK and -d $PID options
kill: add a feature decoding signal masks
The directory can be directly used by libuuid, for example, by running
"uuidgen --time" as root, even if the uuidd daemon is not installed.
In this case, we must create a clock.txt file with the uuidd group to
prevent any potential ownership mismatch if the uuidd daemon is
installed later. The 2xxx mode (setgid) forces open(O_CREAT) in
libuuid to create the file with the uuidd group.
Please note that mode 2755 is the standard used for years in RHEL.
David Gibson [Tue, 9 Jul 2024 05:44:31 +0000 (15:44 +1000)]
unshare: Add options to identity map the user's subordinate uids and gids
--map-users=auto, --map-groups=auto and --map-auto allow automatically
mapping the first block of user or group IDs owned by the effective user
from /etc/sub[ug]id to a block starting at user ID 0. Add options
--map-users=subids, --map-groups=subids and --map-subids to perform a
mapping of the same IDs, but as an identity mapping instead of to UID 0.
This is useful in similar situations to --map-current-user, but preserves
access to the user's subordinate IDs. That allows nested namespaces to
be created with more complex user mappings, either with unshare or with
a container runtime such as podman.
Fixes: https://github.com/util-linux/util-linux/issues/3120 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
column: Adds option -S <num> so whitespaces are used instead of tabs in non table mode.
Entries are padded with whitespaces, then <num> spaces are added to separate the columns.
This should fix https://github.com/util-linux/util-linux/issues/1551
Karel Zak [Tue, 2 Jul 2024 09:14:06 +0000 (11:14 +0200)]
lib/fileutils: add ul_basename()
Unfortunately, the basename() function can be affected by the
creativity of different libc authors, resulting in varying behavior
across implementations.
Instead, use a local implementation to ensure consistency and
portability.
Karel Zak [Tue, 2 Jul 2024 07:32:19 +0000 (09:32 +0200)]
Merge branch 'automake/install-dependency' of https://github.com/t-8ch/util-linux
* 'automake/install-dependency' of https://github.com/t-8ch/util-linux:
autotools: Properly order install dependencies of pam_lastlog2
autotools: make pam install path configurable
Unfortunately, the behavior is different between DOS (original docs)
and GPT. Due to the need for backward compatibility, it is likely
impossible to change the default setting ...
Addresses: https://github.com/util-linux/util-linux/issues/3097 Signed-off-by: Karel Zak <kzak@redhat.com>
Thomas Weißschuh [Sun, 30 Jun 2024 09:23:53 +0000 (11:23 +0200)]
autotools: Properly order install dependencies of pam_lastlog2
As pam_lastlog2 is relinked during installation, all its dependencies
need to already be installed.
This is the same issue that affected pylibmount which was fixed in
commit 324330aca644 ("build-sys: Properly order install dependencies of pylibmount").
Extend the logic added in that commit to also apply to pam_lastlog2.
Closes: #3011 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
While at it, also move the initial definition of
usesecurelib_exec_LTLIBRARIES into Makefile.am.
Also add "exec" to the target name which is recognized by automake to
mark the targets as architecture-specific.
Stanislav Brabec [Wed, 19 Jun 2024 15:31:34 +0000 (17:31 +0200)]
umount, losetup: Document loop destroy behavior
The loop device detach runs asynchronously in the background. It can cause
unexpected errors. Document the possible existence of the loop device after
exit of losetup -d or umount and need of "udevadm settle".
Laurent Vivier [Wed, 19 Jun 2024 08:19:51 +0000 (10:19 +0200)]
unshare: load binfmt_misc interpreter
add -l, --load-interp <file> to load a binfmt_misc interpreter at startup.
The interpreter is loaded from the initial fileystem if the 'F' flags is
provided, otherwise from inside the new namespace
This makes possible to start a chroot of another architecture without
being root.
Thomas Weißschuh [Wed, 12 Jun 2024 21:32:15 +0000 (23:32 +0200)]
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()
sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.
Now it's also valid for sz and bufsz to be equal.
See #3088. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Thu, 13 Jun 2024 09:39:34 +0000 (11:39 +0200)]
lib/buffer: introduce ul_buffer_get_string()
Some users need a zero-byte-terminated string.
As the buffer internally already maintains a zero-termination, add a
helper function that exposes this to users.