From 4c1c5dc36c96a8e6dd34fd43caf83d292a33b797 Mon Sep 17 00:00:00 2001 From: Colin Watson 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 +# 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);