[PATCH] tests/file_handle.c: skip if fs can't do handles

Alyssa Ross hi at alyssa.is
Mon May 3 13:12:13 UTC 2021


Quoting name_to_handle_at(2):

> Some care is needed here as EOVERFLOW can also indicate that no file
> handle is available for this particular name in a filesystem which
> does normally support file-handle lookup.  This case can be detected
> when the EOVERFLOW error is returned without handle_bytes being
> increased.

This patch handles that case, resolving 20 failures for me on ZFS, and
making `make check' able to run successfully.
---
 tests/file_handle.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/file_handle.c b/tests/file_handle.c
index 86d51b63..da544c2f 100644
--- a/tests/file_handle.c
+++ b/tests/file_handle.c
@@ -206,8 +206,11 @@ main(void)
 	       path, path_secontext,
 	       handle->handle_bytes, &mount_id);
 
-	assert(syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id,
-		flags) == 0);
+	errno = 0;
+	syscall(__NR_name_to_handle_at, fdcwd, path, handle, &mount_id, flags);
+	if (EOVERFLOW == errno)
+		perror_msg_and_skip("name_to_handle_at");
+	assert(!errno);
 	printf("%s%s(AT_FDCWD, \"%s\"%s, {handle_bytes=%u"
 	       ", handle_type=%d, f_handle=",
 	       my_secontext, "name_to_handle_at",
-- 
2.31.0



More information about the Strace-devel mailing list