Karel Zak [Tue, 9 May 2023 11:25:09 +0000 (13:25 +0200)]
fsck: use BLKID_SUBLKS_BADCSUM
We need to be a little bit more promiscuou in fsck to see also
inconsistent superblocks.
It would be possible to do not use libmount to ask for filesystem type
and ask directly libblkid, but libmount is also used to parse fstab
and search in the file and in this case it caches FS tags. It seems
better to continue with libmount to reduce overhead and keep the code
simple.
Addresses: https://github.com/util-linux/util-linux/issues/2214 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 2 May 2023 11:27:52 +0000 (13:27 +0200)]
libmount: (subdir) support unshared sessions too
* enter original namespace for the final move_mount(), it means that
the original unshare() (to create the temporary mount) will be
ineffective for this final step. God bless FD based APIs (setns()
and open_tree())! ;-)
* improve cleanup code (call umount only once)
* remember private namespace
* update note in man page
Addresses: https://github.com/util-linux/util-linux/pull/2198 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 2 May 2023 10:13:53 +0000 (12:13 +0200)]
Merge branch 'mount/qemu-user' of https://github.com/t-8ch/util-linux
* 'mount/qemu-user' of https://github.com/t-8ch/util-linux:
mount: (tests) run bind mount tests on qemu-user
ci: (s390x) run container privileged and with access to /dev
mount: (tests) also skip tests on private,slave propagation
mount: (tests) skip fstab-btrfs on broken ENOTTY return
lsns: (tests) skip nsfs test on broken ENOTTY return
tests: (test_sysinfo) add helper for invalid ioctl errno
libmount: fix some typos
Karel Zak [Tue, 2 May 2023 10:13:27 +0000 (12:13 +0200)]
Merge branch 'hwclock/skip-test-show' of https://github.com/t-8ch/util-linux
* 'hwclock/skip-test-show' of https://github.com/t-8ch/util-linux:
hwclock: (tests) mark show test failed on GitHub Actions
tests: (functions.sh): add func to detect virtualization platform
Karel Zak [Wed, 26 Apr 2023 14:52:18 +0000 (16:52 +0200)]
Merge branch 'enosys/fixes' of https://github.com/t-8ch/util-linux
* 'enosys/fixes' of https://github.com/t-8ch/util-linux:
mount: (tests) skip test if test_enosys is nonfunctional
test_enosys: provide more diagnostics on failure
test_enosys: use correct return value for getopt_long
Karel Zak [Wed, 26 Apr 2023 09:36:08 +0000 (11:36 +0200)]
Merge branch 'login-utils/supam_conv_fix' of https://github.com/Stefan-Radu/util-linux
* 'login-utils/supam_conv_fix' of https://github.com/Stefan-Radu/util-linux:
wrap return in #else directive to avoid dead code
add return in supam_conv function
Karel Zak [Tue, 25 Apr 2023 14:42:36 +0000 (16:42 +0200)]
Merge branch 'libmount/enosys' of https://github.com/t-8ch/util-linux
* 'libmount/enosys' of https://github.com/t-8ch/util-linux:
mount: (tests) add disabled testcase for mount without move_mount()
mount: (tests) test fallback codepaths
tests: add test_enosys helper
Chris Webb [Mon, 24 Apr 2023 16:14:47 +0000 (17:14 +0100)]
libmount: Don't silently accept an X-mount.idmap with only whitespace
X-mount.idmap accepts a series of whitespace-separated tokens. We reject
an empty argument but silently accept an argument consisting of whitespace
with no tokens. Test for the empty case more thoroughly.
[kzak@redhat.com: - use skip_blank()]
Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Chris Webb [Sun, 23 Apr 2023 16:05:07 +0000 (17:05 +0100)]
libmount: check for errors from prep-options hooks
fix_optstr() in context_mount.c calls the MNT_STAGE_PREP_OPTIONS hooks
but discards returned errors. This suppresses error messages and can
make invalid option strings 'fail open' in surprising ways. Handle error
returns from these hooks correctly.
No other callers of mnt_context_call_hooks() discard the return value,
so other hooks aren't affected.
Karel Zak [Thu, 20 Apr 2023 10:10:17 +0000 (12:10 +0200)]
Merge branch 'lsfd--ping-test-description' of https://github.com/masatake/util-linux
* 'lsfd--ping-test-description' of https://github.com/masatake/util-linux:
tests: (lsfd) add losetup as a required cmd
tests: (lsfd) make the message for skipping the case more descriptive
tests: (mkfds) delete nls markers _("...") from the helper command
The option-inet test case has not run because it was incorrectly kept
as non-executable.
Mark the test case as "skip" in qmeu-user before making the test case
executable because we already know the case fails on qmeu-user. A fix
on qmeu-user may come later.
Karel Zak [Tue, 18 Apr 2023 13:54:25 +0000 (15:54 +0200)]
libmount: cleanup all stat() use
* don't use STATX_MODE as we need only file type
* use fstatat() or stat() as fallback on EOPNOTSUPP
* use st_rdev from statx() too
* rename to mnt_stat_mountpoint() to more generic mnt_safe_stat()
* use mnt_is_path() on more places
* cleanup mnt_context_*_excode() to not use stat()
* use on others places mnt_safe_stat()
Note that on some places stat() remaining, but it's not related to the
mountpoints, it's about /run/mount/utab permissions, file locking and
/dev/* permissions for non-root mounts.
Karel Zak [Mon, 17 Apr 2023 12:23:18 +0000 (14:23 +0200)]
libmount: use AT_STATX_DONT_SYNC when touch mountpoints
* prefer statx() with AT_STATX_DONT_SYNC if available
* keep fstatat() and stat() as fallback
* add test to mnt_stat_mountpoint()
The goal is to minimize situations when we need classic stat() because
it triggers automount, and stat() syscall may hang on unreachable
network filesystems. The automount issue was resolved years ago by
AT_NO_AUTOMOUNT; now we can use statx() to fix also hangs on NFS.
Addresses: https://github.com/util-linux/util-linux/issues/2049 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 17 Apr 2023 11:06:01 +0000 (13:06 +0200)]
Merge branch 'libblkid/crc32c-exclude' of https://github.com/t-8ch/util-linux
* 'libblkid/crc32c-exclude' of https://github.com/t-8ch/util-linux:
libblkid: xfs: clean up call to ul_crc32_exclude_offset
libblkid: erofs: calculate checksum with offset
Karel Zak [Mon, 17 Apr 2023 10:29:40 +0000 (12:29 +0200)]
hwclock: use kernel struct rtc_time for RTC ioctls
Based on patch from Matt Nourse.
Addresses: https://github.com/util-linux/util-linux/pull/2123 Reported-by: Matthew Nourse <matthew@nplus1.com.au> Signed-off-by: Karel Zak <kzak@redhat.com>