summaryrefslogtreecommitdiffstats
path: root/debian/patches/skip-utimensat-test-on-zfs.patch
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/skip-utimensat-test-on-zfs.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/patches/skip-utimensat-test-on-zfs.patch b/debian/patches/skip-utimensat-test-on-zfs.patch
new file mode 100644
index 0000000..9a4440f
--- /dev/null
+++ b/debian/patches/skip-utimensat-test-on-zfs.patch
@@ -0,0 +1,55 @@
+From 3a5a49f1a4355e7f75ec350cb13f46ea835058da 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);