Karel Zak [Tue, 11 Jun 2024 09:55:39 +0000 (11:55 +0200)]
libmount: Add API to get/set unique IDs
Since the Linux kernel version 6.8, there are two types of IDs
available: the "old" ID used in /proc/self/mountinfo, and a new 64-bit
unique ID that is never recycled. This new ID is provided by the
statx(STATX_MNT_ID_UNIQUE) and statmount() syscalls.
Note that this patch only adds the API for retrieving these unique
IDs, but the backing code has not been implemented yet.
Karel Zak [Mon, 22 Jul 2024 12:12:37 +0000 (14:12 +0200)]
libmount: add mount-api-utils.h to mountP.h
The new syscalls (statmount and fd-based mount) are already being
utilized in various areas within the library. Therefore, it would be
more efficient to include the syscalls header file in the private main
library header file.
Karel Zak [Wed, 14 Aug 2024 13:33:44 +0000 (15:33 +0200)]
include/mount-api-utils: add statmount and listmount
* Make the includes and ifdefs in the file more generic, to cover
other interfaces besides just HAVE_MOUNTFD_API.
* Add #ifdef HAVE_STATMOUNT_API to the header file.
* Add fallbacks for statmount and listmount masks and flags.
* Add a local definition of the structs mnt_id_req and statmount.
We do not want to depend on kernel headers for now, as all of this is
still under development. Installed headers may provide old versions,
and a solution based on #ifdef will still require local definition of
the structs.
* Add wrappers for the statmount() and listmount() syscalls.
* Add sys_statmount(), a wrapper for statmount() that reallocates the
statmount buffer (on EOVERFLOW errno) if it is not large enough.
Note that for now, we are directly using syscalls and do not require
libc support for statmount() and listmount(). The kernel API is very
extensible, as it is based on structs rather than syscall arguments.
Therefore, I doubt we will see any libc support in the near future.
The code uses the "ul_" prefix for locally defined variables and
functions to prevent conflicts with kernel headers and potential
future versions of libc.
Karel Zak [Wed, 8 Jan 2025 11:40:30 +0000 (12:40 +0100)]
Merge branch 'revise--test-cases' of https://github.com/masatake/util-linux
* 'revise--test-cases' of https://github.com/masatake/util-linux:
tests: (lsfd::mkfds_vsock) skip if diag socket for AF_VSOCK is unavailable
tests: (test_mkfds::sockdiag) support AF_VSOCK family
tests: (lsns::filter) skip if /proc/self/uid_map is not writable
Sam James [Wed, 8 Jan 2025 06:49:40 +0000 (06:49 +0000)]
meson: add missing `is_disabler` checks
Noticed this when looking at why the `check` target isn't created
with `-Dauto_features=disabled`. This doesn't fix that but it does
fix a bunch of issues I noticed along the way after a hint from Eli Schwartz.
Karel Zak [Fri, 3 Jan 2025 09:48:25 +0000 (10:48 +0100)]
Merge branch 'lsfd--vsock' of https://github.com/masatake/util-linux
* 'lsfd--vsock' of https://github.com/masatake/util-linux:
lsfd: support AF_VSOCK sockets
tests: (lsfd-functions.bash) add a missing constant
tests: (lsfd) quote '$' in patterns in a case/esac block
Use gtk-doc constructs to mark up formatted sections of documentation
so that they display properly in the rendered output.
- Enclose code samples with informalexample+programlisting tags
- Enclose preformatted blocks of text (tables) in same
- Present numbered lists in markdown format (leading 1., 2., etc.)
so that they're translated into HTML ordered lists
Karel Zak [Thu, 26 Dec 2024 11:06:08 +0000 (12:06 +0100)]
Merge branch 'lsfd--hyperlinks' of https://github.com/masatake/util-linux
* 'lsfd--hyperlinks' of https://github.com/masatake/util-linux:
lsfd: don't enable hyperlinks for deleted files
lsfd: enable hyperlinks only for regular files and directories
lsfd: add --hyperlink command line option
tests: (test_sysinfo) add a helper to call xgethostname
lsfd: consolidate add_column()
Karel Zak [Thu, 26 Dec 2024 10:34:10 +0000 (11:34 +0100)]
fstab.5 mount.8: add note about field separator
The value of the mount option X-mount.idmap= can contain spaces as
separators between mappings. Unfortunately, this conflicts with the
fstab format where fields are separated by spaces. Using quotes does
not solve this issue because fields are separated before they are
parsed.
This limitation of the fstab parser within libmount is due to backward
compatibility. The fstab format is a de-facto standard and is parsed
by many tools and libraries, including third-party shell scripts. It
would not be practical to introduce any improvements in libmount that
would make fstabs unparseable in other places.
Users must understand that in-field spaces must be escaped by \040.
For example, X-mount.idmap="0:0:1\040500:1000:1".
Addresses: https://github.com/util-linux/util-linux/issues/2829 Signed-off-by: Karel Zak <kzak@redhat.com>
LiviaMedeiros [Mon, 16 Dec 2024 10:40:37 +0000 (11:40 +0100)]
tests: add skips when IPv6 is not supported
Before this change on systems with disabled IPv6 (e.g. `CONFIG_IPV6 is
not set` in kernel config), `lsfd/mkfds-tcp6` and `lsfd/mkfds-udp6` were
failing, and `lsfd/option-inet` was hanging forever, making it
impossible to complete the tests.
Karel Zak [Mon, 2 Dec 2024 11:50:29 +0000 (12:50 +0100)]
lsfd: consolidate add_column()
* use only column IDs in add_column() callers
* don't work with "struct colinfo" in callers
* rename add_column_by_id() to add_hidden_column() as it's very
special function used only by filters
Karel Zak [Tue, 10 Dec 2024 11:24:59 +0000 (12:24 +0100)]
Merge branch 'ft-algorithm-params' of https://github.com/LiviaMedeiros/util-linux
* 'ft-algorithm-params' of https://github.com/LiviaMedeiros/util-linux:
zramctl: rename `--params` into `--algorithm-params`
zramctl: add support for `algorithm_params`
Maks Mishin [Tue, 10 Dec 2024 09:26:32 +0000 (12:26 +0300)]
sys-utils: (setpriv): fix potential memory leak
Dynamic memory, referenced by 'my_caps' is allocated by calling function 'xstrdup'
add then changed by calling of strsep function.
The free(my_caps) call is incorrect if my_caps != NULL, and points to some
place inside or outside the source string.
Zhaoming Luo [Mon, 9 Dec 2024 11:16:11 +0000 (19:16 +0800)]
hwclock: Support GNU Hurd
* configure.ac: add HURD so it can be used in conditional in am files
* sys-utils/Makemodule.am: compile hwclock for GNU Hurd
* sys-utils/hwclock-rtc.c: compile for GNU Hurd
* sys-utils/hwclock.c: compile for GNU Hurd
* sys-utils/hwclock.h: compile for GNU Hurd
Zhaoming Luo [Mon, 9 Dec 2024 02:11:54 +0000 (10:11 +0800)]
hwclock: Remove ioperm declare as it causes nested extern declare warning
The extern declaration causes the following warning:
```
CC sys-utils/hwclock-hwclock-cmos.o
sys-utils/hwclock-cmos.c: In function 'i386_iopl':
sys-utils/hwclock-cmos.c:356:20: warning: nested extern declaration of 'ioperm' [-Wnested-externs]
356 | extern int ioperm(unsigned long from, unsigned long num, int turn_on);
| ^~~~~~
sys-utils/hwclock-cmos.c:356:20: warning: redundant redeclaration of 'ioperm' [-Wredundant-decls]
In file included from sys-utils/hwclock-cmos.c:68:
/usr/include/i386-gnu/sys/io.h:29:12: note: previous declaration of 'ioperm' with type 'int(long unsigned int, long unsigned int, int)'
29 | extern int ioperm (unsigned long int __from, unsigned long int __num,
| ^~~~~~
CCLD hwclock
```
Karel Zak [Fri, 6 Dec 2024 09:05:25 +0000 (10:05 +0100)]
Merge branch 'posix-argument-order' of https://github.com/nilfsuser5678/util-linux
* 'posix-argument-order' of https://github.com/nilfsuser5678/util-linux:
libmount: exec mount helpers with posixly correct argument order
libmount/context_mount: fix argument number comments
nilfsuser5678 [Fri, 29 Nov 2024 17:27:12 +0000 (17:27 +0000)]
libmount: exec mount helpers with posixly correct argument order
This improves compatibility with non-gnu userspaces.
On systems where the libc provides posix getopt instead of gnu getopt,
mount helpers which use getopt to parse arguments will not parse
options which appear after non-option arguments. This patch ensures
mount/unmount work as expected in this situation.
mount: fix expected argument order for mount helpers in tests
Reads of ext superblocks can race with updates. If libblkid observes a
checksum mismatch, re-read the superblock with O_DIRECT in order to get
a consistent view of its contents. Only if the O_DIRECT read fails the
checksum should it be reported to have failed.
This fixes a problem where devices that were named by filesystem label
failed to be found when systemd attempted to mount them on boot. The
problem was caused by systemd-udevd using libblkid. If a read of a
superblock resulted in a checksum mismatch, udev will remove the
by-label links which result in the mount call failing to find the
device. The checksum mismatch that was triggering the problem was
spurious, and when we use O_DIRECT, or even perform a subsequent retry,
the superblock is correctly read. This resulted in a failure to mount
/boot in one out of every 2,000 or so attempts in our environment.
e2fsprogs fixed[1] an identical version of this bug that afflicted
resize2fs during online grow operations when run from cloud-init. The
fix there was also to use O_DIRECT in order to read the superblock.
This patch uses a similar approach: read the superblock with O_DIRECT in
the case where a bad checksum is detected.
Karel Zak [Mon, 25 Nov 2024 11:38:00 +0000 (12:38 +0100)]
Merge branch 'su-runuser-improvements' of https://github.com/calestyo/util-linux
* 'su-runuser-improvements' of https://github.com/calestyo/util-linux:
man pages: document `--user` option for `runuser`
man pages: use `user` rather than `username`
bash-completion: add `--pty` and `--no-pty` options for `su` and `runuser`
bash-completion: complete `--user` only for `runuser`, not for `su`
Karel Zak [Mon, 25 Nov 2024 11:10:37 +0000 (12:10 +0100)]
zramctl: add COMP-RATIO column
* Improve get_mm_stat() to return both numbers and strings.
* Add get_mm_stat_number() and get_mm_stat_string() functions.
* Add a new COL_COMPRATIO column.
Based on https://github.com/util-linux/util-linux/pull/3293
Co-Author: davidemanini Signed-off-by: Karel Zak <kzak@redhat.com>