Karel Zak [Tue, 14 May 2024 09:58:20 +0000 (11:58 +0200)]
libmount: Fix atime remount for new API
All atime settings are mutually exclusive, and the attr_set mask for
the mount_setattr() syscall cannot contain multiple MOUNT_ATTR_ atime
related options.
Unfortunately, during a remount, the list of options is composed of
both old and new options. In this case, libmount sets more atime
options to the mask. The correct behavior is to use the last atime
related option from the list.
Fixes: https://github.com/util-linux/util-linux/issues/3032 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 14 May 2024 08:01:47 +0000 (10:01 +0200)]
Merge branch 'uuidv7' of https://github.com/t-8ch/util-linux
* 'uuidv7' of https://github.com/t-8ch/util-linux:
uuidgen: add support for RFC9562 UUIDs
uuidparse: add support for RFC9562 UUIDs
libuuid: add support for RFC9562 UUIDs
Based on https://github.com/util-linux/util-linux/pull/3018
The syscall numbers should not be hardcoded in the header file. If we
really need them, there is UL_CHECK_SYSCALL() to define the numbers
for different architectures. I doubt it's really necessary. Just
update your kernel header files to get the latest kernel updates ...
Karel Zak [Mon, 13 May 2024 07:58:21 +0000 (09:58 +0200)]
Merge branch 'meson-fix-Python.h-check' of https://github.com/jwillikers/util-linux
* 'meson-fix-Python.h-check' of https://github.com/jwillikers/util-linux:
meson: Correctly require the Python.h header for the python dependency
meson: Only require Python module when building pylibmount
meson: Fix build-python option
Karel Zak [Mon, 13 May 2024 06:42:06 +0000 (08:42 +0200)]
Merge branch 'lsns--refactor-related-to-2987' of https://github.com/masatake/util-linux
* 'lsns--refactor-related-to-2987' of https://github.com/masatake/util-linux:
lsns: (refactor) use ls_path_{openf|statf} to make the code simple
lib/path: add ul_path_statf() and ul_path_vstatf()
lsns: verify the uniqueness of a namespace in ls->namespaces list
lsns: (refactor) make the function names for reading namespaces consistent
lsns: (refactor) rename read_related_namespaces to connect_namespaces
lsns: (refactor) rename get_ns_ino() to get_ns_inos()
lsns: (refactor) use get_{parent|owner}_ns_ino() in add_namespace_for_nsfd
lsns: (refactor) add get_{parent|owner}_ns_ino() implementing some parts of get_ns_ino()
lsns: (refactor) give a enumeration name 'lsns_type' to LSNS_TYPE_ enumerators
lsns: (refactor) rename LSNS_ID_.* to LSNS_TYPE_.*
Jordan Williams [Tue, 7 May 2024 14:40:44 +0000 (09:40 -0500)]
meson: Correctly require the Python.h header for the python dependency
The current solution to require the Python.h header works around a bug
in Meson that has been fixed for version 1.4.1 of Meson.
Refer to https://github.com/mesonbuild/meson/issues/12862.
This change uses an explicit check for the Python.h include.
This verifies the required header exists.
This check is only necessary prior to version 1.4.1 of Meson.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Thu, 9 May 2024 21:46:58 +0000 (16:46 -0500)]
meson: Only require Python module when building pylibmount
Only the python executable is required for tests.
Version 1.4.1 of Meson will require the Python.h for find_installation.
This will result in the tests requiring Python.h unnecessarily.
Use find_program to find the Python program for the tests instead.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
Jordan Williams [Thu, 9 May 2024 20:57:12 +0000 (15:57 -0500)]
meson: Fix build-python option
The build-python option is for controlling whether or not pylibmount is
built.
Unfortunately, commit b6799cc rendered the option unused.
This change uses the build-python option again.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>
All the existing tests are also done with --fcntl in effect, and then
we add one more test, namely that a flock(2) lock can be be obtained
even while a fcntl(2) lock is held - not that anyone should ever need
that, but it does show that the lock types are completely independent.
Masatake YAMATO [Wed, 1 May 2024 02:46:05 +0000 (11:46 +0900)]
lsns: (refactor) add get_{parent|owner}_ns_ino() implementing some parts of get_ns_ino()
get_ns_ino() returns three inode numbers. The code for the two of three,
inodes for PARENT and USERNS, is moved to the new functions.
So we can reuse the code in other places in lsns.
Karel Zak [Wed, 1 May 2024 19:17:52 +0000 (21:17 +0200)]
Merge branch 'lsfd/fcntl' of https://github.com/t-8ch/util-linux
* 'lsfd/fcntl' of https://github.com/t-8ch/util-linux:
lsfd: include buffer.h in decode-file-flags.h
buffer: replace include of c.h with stddef.h
lsfd: move interface of decode-file-flags to header
Masatake YAMATO [Wed, 1 May 2024 02:07:31 +0000 (11:07 +0900)]
lsns: (refactor) rename LSNS_ID_.* to LSNS_TYPE_.*
Functions taking LSNS_ID_ as arguments have .*_lsns_type_.* or
.*_type_.* as parts of their name. This implies the prefix LSNS_TYPE_
is more consistent than LSNS_ID_.
Karel Zak [Mon, 29 Apr 2024 08:26:25 +0000 (10:26 +0200)]
Merge branch 'lsns--debug-ioctl_ns-test-for-master' of https://github.com/masatake/util-linux
* 'lsns--debug-ioctl_ns-test-for-master' of https://github.com/masatake/util-linux:
tests: (lsns::ioctl_ns) add more debug print
tests: (lsns::ioctl_ns) record stdout/stderr for debugging the case
coresched: Manage core scheduling cookies for tasks
Co-authored-by: Phil Auld <pauld@redhat.com> Signed-off-by: Phil Auld <pauld@redhat.com> Signed-off-by: Thijs Raymakers <thijs@raymakers.nl> Signed-off-by: Karel Zak <kzak@redhat.com> Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Sun, 28 Apr 2024 21:35:12 +0000 (23:35 +0200)]
lsfd: include linux/fcntl.h
asm/-headers are implementation details and not meant to be included
directly. Instead use the linux/ header which will always include the
correct asm/-headers.
flock: add support for using fcntl() with open file description locks
Currently, there is no way for shell scripts to safely access
resources protected by POSIX locking (fcntl with the F_SETLK/F_SETLKW
commands). For example, the glibc function lckpwdf(), used to
protect access to the /etc/shadow database, works by taking a
F_SETLKW on /etc/.pwd.lock .
Due to the odd semantics of POSIX locking (e.g. released when any file
descriptor associated to the inode is closed), we cannot usefully
directly expose the POSIX F_SETLK/F_SETLKW commands. However, linux
3.15 introduced F_OFD_SETLK[W], with semantics wrt. ownership and
release better matching those of flock(2), and crucially they do
conflict with locks obtained via F_SETLK[W]. With this, a shell script
can do
exec 4> /etc/.pwd.lock
flock --fcntl 4
<access/modify /etc/shadow ...>
flock --fcntl --unlock 4 # or just exit
without conflicting with passwd(1) or other utilities that
access/modify /etc/shadow.
No single-letter shorthand is defined for the option, because this is
somewhat low-level and the user really needs to know what he is doing.
Also, this leaves the door open for teaching --fcntl to accept an
optional argument: "ofd", the default, and "posix", should anyone find
a use for flock(1) taking a F_SETLK[W] lock.
tests: (lsns::ioctl_ns) record stdout/stderr for debugging the case
When the test case runs successfully, we expect the case test prints
nothing to stderr. If something is printed to stderr, it helps us
debug lsns command and the test case.
Karel Zak [Thu, 25 Apr 2024 09:22:32 +0000 (11:22 +0200)]
Merge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux
* 'meson-more-build-options' of https://github.com/jwillikers/util-linux: (21 commits)
meson: Add build-lsclocks option
meson: Add build-enosys option
meson: Define _DARWIN_C_SOURCE on macOS as is done in Autotools
strutils.h: Include strings.h header for strncasecmp function
xalloc.h: Include stdio.h header for vasprintf function
meson: Fix build by default and install behavior for build-pipesz option
meson: Add build-fadvise option
meson: Add build-scriptlive option
meson: Add build-script option
meson: Require pty for the su and runuser executables
meson: Add have_pty variable to check if pty is available
meson: Add build-blockdev option
meson: Add build-chcpu option
meson: Use has_type instead of sizeof to detect cpu_set_t type
meson: Add build-setarch option
meson: Add build-rtcwake option
meson: Add build-ldattach option
meson: Add build-blkdiscard option
meson: Add build-fsfreeze option
meson: Add build-blkzone option
...
Jordan Williams [Mon, 22 Apr 2024 14:42:25 +0000 (09:42 -0500)]
meson: Add build-blockdev option
Only build blockdev on Linux.
The BLKROSET macro is used in blockdev.c from blkdev.h.
The blkdev.h header only defines this macro when it is missing on Linux.
Add blockdev to the list of executables, which appears to have been
omitted previously.
Signed-off-by: Jordan Williams <jordan@jwillikers.com>