summaryrefslogtreecommitdiffstats
path: root/debian/patches/skip-utimensat-test-on-zfs.patch
blob: 6a50e08a0e254f8d8faba2bb2180bfaab3e2d425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From c295622811895faaf4c0be0820cbb919c80b1143 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);