GNU bug report logs - #20312
[COREUTILS 0/2] Improved acl handling

Previous Next

Package: coreutils;

Reported by: Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>

Date: Sun, 12 Apr 2015 16:20:04 UTC

Severity: normal

Merged with 20310, 20311, 20666, 20667, 20696

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>
To: bug-gnulib <at> gnu.org, 20312 <at> debbugs.gnu.org
Subject: bug#20312: [COREUTILS 2/2] ls: Don't treat lack of acl support as an error
Date: Sun, 12 Apr 2015 16:37:27 +0200
* src/ls.c (file_has_acl_cache): When a file system doesn't support
acls, fail with errno set to ENOTSUP.
(gobble_file): Don't treat lack of acl support as an error.
---
 src/ls.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/ls.c b/src/ls.c
index b308dd3..884e042 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -2866,7 +2866,7 @@ getfilecon_cache (char const *file, struct fileinfo *f, bool deref)
 
 /* Cache file_has_acl failure, when it's trivial to do.
    Like file_has_acl, but when F's st_dev says it's on a file
-   system lacking ACL support, return 0 with ENOTSUP immediately.  */
+   system lacking ACL support, fail with ENOTSUP immediately.  */
 static int
 file_has_acl_cache (char const *file, struct fileinfo *f)
 {
@@ -2877,14 +2877,11 @@ file_has_acl_cache (char const *file, struct fileinfo *f)
   if (f->stat.st_dev == unsupported_device)
     {
       errno = ENOTSUP;
-      return 0;
+      return -1;
     }
 
-  /* Zero errno so that we can distinguish between two 0-returning cases:
-     "has-ACL-support, but only a default ACL" and "no ACL support". */
-  errno = 0;
   int n = file_has_acl (file, &f->stat);
-  if (n <= 0 && errno_unsupported (errno))
+  if (n < 0 && errno_unsupported (errno))
     unsupported_device = f->stat.st_dev;
   return n;
 }
@@ -3076,7 +3073,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
           if (err == 0 && format == long_format)
             {
               int n = file_has_acl_cache (absolute_name, f);
-              err = (n < 0);
+              err = (n < 0 && ! errno_unsupported (errno));
               have_acl = (0 < n);
             }
 
-- 
2.1.0





This bug report was last modified 10 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.