> FAIL: test-file-has-acl.sh
> ==========================
>
> file_has_aclinfo failed for "tmpfile0"
> file_has_acl("tmpfile0") returned , expected no
> FAIL test-file-has-acl.sh (exit status: 1)
>
> FAIL: test-file-has-acl-1.sh
> ============================
>
> file_has_aclinfo failed for "tmpfile0"
> file_has_acl("tmpfile0") returned , expected no
> FAIL test-file-has-acl-1.sh (exit status: 1)
>
> FAIL: test-file-has-acl-2.sh
> ============================
>
> file_has_aclinfo failed for "tmpfile0"
> file_has_acl("tmpfile0") returned , expected no
> FAIL test-file-has-acl-2.sh (exit status: 1)
Fixed by this patch. It is merely to make the test suite happy;
real users of file_has_aclinfo should set the _GL_DT_NOTDIR bit
in the flags in order to avoid this useless acl_get_file() call.
2024-10-07 Bruno Haible <[email protected]>
file-has-acl: Fix test failure on Cygwin.
* lib/file-has-acl.c (file_has_aclinfo): On Cygwin, don't fail if
acl_get_file (name, ACL_TYPE_DEFAULT) returns NULL on a file of unknown
type.
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 0dfd25b52a..64291e02d4 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -483,7 +483,14 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
# endif
}
else
- ret = -1;
+ {
+# ifdef __CYGWIN__ /* Cygwin >= 2.5 */
+ if (d_type == DT_UNKNOWN)
+ ret = 0;
+ else
+# endif
+ ret = -1;
+ }
}
# endif
}