listxattr() was seen to return ENOTSUP on viriofs,
which resulted in ls outputting "Not supported" errors.

* lib/file-has-acl.c (aclinfo_may_indicate_xattr): Treat any
non valid acl errno as being inconclusive as to whether there
are xattrs available.
---
 ChangeLog          | 9 +++++++++
 lib/file-has-acl.c | 7 ++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bef68432ee..9b8b525ee8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-01-15  Pádraig Brady  <p...@draigbrady.com>
+
+       file-has-acl: handle listxattr returning ENOTSUP
+       listxattr() was seen to return ENOTSUP on viriofs,
+       which resulted in ls outputting "Not supported" errors.
+       * lib/file-has-acl.c (aclinfo_may_indicate_xattr): Treat any
+       non valid acl errno as being inconclusive as to whether there
+       are xattrs available.
+
 2025-01-14  Bruno Haible  <br...@clisp.org>
 
        assert-h: Fix compilation error with gcc >= 13 on Solaris 11.
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index e8413f8f85..c02cfee842 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -101,14 +101,15 @@ enum {
 
 /* AI indicates XATTR may be present but wasn't accessible.
    This is the case when [l]listxattr failed with E2BIG,
-   or failed with EACCES which in Linux kernel 6.12 NFS can mean merely
-   that we lack read access.
+   or is not supported (!acl_errno_valid()), or failed with EACCES
+   which in Linux kernel 6.12 NFS can mean merely that we lack read access.
 */
 
 static bool
 aclinfo_may_indicate_xattr (struct aclinfo const *ai)
 {
-  return ai->size < 0 && (ai->u.err == EACCES || ai->u.err == E2BIG);
+  return ai->size < 0 && (!acl_errno_valid (ai->u.err)
+                          || ai->u.err == EACCES || ai->u.err == E2BIG);
 }
 
 /* Does NAME have XATTR?  */
-- 
2.47.1


Reply via email to