55 lines
1.5 KiB
Diff
55 lines
1.5 KiB
Diff
From 44616edf6f926b9fec6a322c755fb1bb8c90e7fe Mon Sep 17 00:00:00 2001
|
|
From: Colin Watson <cjwatson@debian.org>
|
|
Date: Mon, 11 Mar 2024 16:24:49 +0000
|
|
Subject: Skip utimensat test on ZFS
|
|
|
|
On ZFS (which may be used by e.g. `autopkgtest-virt-incus`), `utimensat`
|
|
seems to leave the access time set to 0. It's not clear why.
|
|
|
|
Forwarded: no
|
|
Last-Update: 2024-03-11
|
|
|
|
Patch-Name: skip-utimensat-test-on-zfs.patch
|
|
---
|
|
openbsd-compat/regress/utimensattest.c | 17 +++++++++++++++++
|
|
1 file changed, 17 insertions(+)
|
|
|
|
diff --git a/openbsd-compat/regress/utimensattest.c b/openbsd-compat/regress/utimensattest.c
|
|
index bbc66c485..662d58146 100644
|
|
--- a/openbsd-compat/regress/utimensattest.c
|
|
+++ b/openbsd-compat/regress/utimensattest.c
|
|
@@ -33,6 +33,12 @@
|
|
# define AT_SYMLINK_NOFOLLOW 0x80000000
|
|
#endif
|
|
|
|
+#if defined(HAVE_SYS_VFS_H) && defined(HAVE_STATFS) && defined(HAVE_STRUCT_STATFS_F_FILES)
|
|
+# include <sys/vfs.h>
|
|
+# define ZFS_SUPER_MAGIC 0x2fc12fc1
|
|
+# define HAVE_ZFS_CHECK
|
|
+#endif
|
|
+
|
|
int utimensat(int, const char *, const struct timespec[2], int);
|
|
|
|
static void
|
|
@@ -60,10 +66,21 @@ fail(char *msg, long expect, long got)
|
|
int
|
|
main(void)
|
|
{
|
|
+#ifdef HAVE_ZFS_CHECK
|
|
+ struct statfs sfsb;
|
|
+#endif
|
|
int fd;
|
|
struct stat sb;
|
|
struct timespec ts[2];
|
|
|
|
+#ifdef HAVE_ZFS_CHECK
|
|
+ /* On ZFS, utimensat seems to leave the atime set to 0. */
|
|
+ if (statfs(".", &sfsb) == 0 && sfsb.f_type == ZFS_SUPER_MAGIC) {
|
|
+ fprintf(stderr, "utimensat: skipping test on ZFS\n");
|
|
+ exit(0);
|
|
+ }
|
|
+#endif
|
|
+
|
|
cleanup();
|
|
if ((fd = open(TMPFILE, O_CREAT, 0600)) == -1)
|
|
fail("open", 0, 0);
|