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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20312 in the body.
You can then email your comments to 20312 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#20312; Package coreutils. (Sun, 12 Apr 2015 16:20:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 12 Apr 2015 16:20:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>
To: bug-gnulib <at> gnu.org,
	bug-coreutils <at> gnu.org
Subject: [COREUTILS 0/2] Improved acl handling
Date: Sun, 12 Apr 2015 16:37:25 +0200
Hello,

here are the simple changes for pulling in the gnulib acl handling improvements
into coreutils.


These patches (and the richacl patches on top) are available here:

  https://github.com/andreas-gruenbacher/coreutils


I have tested the code with and without ACL support on Linux. The code
for the other platforms has been transformed as well, but still needs
testing. Could you please help out?

Thanks,
Andreas


Andreas Gruenbacher (2):
  build: updated gnulib acl handling
  ls: Don't treat lack of acl support as an error

 gl/lib/tempname.c.diff | 16 ++++++++--------
 gl/lib/tempname.h.diff |  4 ++--
 gnulib                 |  2 +-
 src/local.mk           |  2 +-
 src/ls.c               | 11 ++++-------
 5 files changed, 16 insertions(+), 19 deletions(-)

-- 
2.1.0





Information forwarded to bug-coreutils <at> gnu.org:
bug#20312; Package coreutils. (Sun, 12 Apr 2015 16:53:03 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>
To: bug-gnulib <at> gnu.org,
	bug-coreutils <at> gnu.org
Subject: [COREUTILS 1/2] build: updated gnulib acl handling
Date: Sun, 12 Apr 2015 16:37:26 +0200
This changes how ls checks for acls on Linux (it no longer requires
libacl) and rewrites how acls are set and copied between files.

* gnulib: Update to latest.
* gl/lib/tempname.c.diff: Adjust for gnulib changes.
* gl/lib/tempname.h.diff: Likewise.
* src/local.mk (src_ls_LDADD):  Only link with the libraries needed by
file_has_acl().
---
 gl/lib/tempname.c.diff | 16 ++++++++--------
 gl/lib/tempname.h.diff |  4 ++--
 gnulib                 |  2 +-
 src/local.mk           |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gl/lib/tempname.c.diff b/gl/lib/tempname.c.diff
index 459a1e5..480aa23 100644
--- a/gl/lib/tempname.c.diff
+++ b/gl/lib/tempname.c.diff
@@ -34,9 +34,9 @@ index 49c7df1..84a45d4 100644
 
  int
 -__try_tempname (char *tmpl, int suffixlen, void *args,
--                int (*try) (char *, void *))
+-                int (*tryfunc) (char *, void *))
 +try_tempname_len (char *tmpl, int suffixlen, void *args,
-+                  int (*try) (char *, void *), size_t x_suffix_len)
++                  int (*tryfunc) (char *, void *), size_t x_suffix_len)
  {
 -  int len;
 +  size_t len;
@@ -113,7 +113,7 @@ index 49c7df1..84a45d4 100644
 +      for (i = 0; i < x_suffix_len; i++)
 +        XXXXXX[i] = letters[randint_genmax (rand_src, sizeof letters - 2)];
 
-       fd = try (tmpl, args);
+       fd = tryfunc (tmpl, args);
        if (fd >= 0)
          {
            __set_errno (save_errno);
@@ -165,14 +165,14 @@ index 49c7df1..84a45d4 100644
 +gen_tempname_len (char *tmpl, int suffixlen, int flags, int kind,
 +                  size_t x_suffix_len)
  {
-   int (*try) (char *, void *);
+   int (*tryfunc) (char *, void *);
 
 @@ -320,5 +328,18 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
        assert (! "invalid KIND in __gen_tempname");
        abort ();
      }
--  return __try_tempname (tmpl, suffixlen, &flags, try);
-+  return try_tempname_len (tmpl, suffixlen, &flags, try, x_suffix_len);
+-  return __try_tempname (tmpl, suffixlen, &flags, tryfunc);
++  return try_tempname_len (tmpl, suffixlen, &flags, tryfunc, x_suffix_len);
 +}
 +
 +int
@@ -183,7 +183,7 @@ index 49c7df1..84a45d4 100644
 +
 +int
 +__try_tempname (char *tmpl, int suffixlen, void *args,
-+                int (*try) (char *, void *))
++                int (*tryfunc) (char *, void *))
 +{
-+  return try_tempname_len (tmpl, suffixlen, args, try, 6);
++  return try_tempname_len (tmpl, suffixlen, args, tryfunc, 6);
  }
diff --git a/gl/lib/tempname.h.diff b/gl/lib/tempname.h.diff
index 843692e..efdaff1 100644
--- a/gl/lib/tempname.h.diff
+++ b/gl/lib/tempname.h.diff
@@ -14,8 +14,8 @@ index f7c98d0..793207f 100644
 @@ -53,5 +55,7 @@ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind);
     name is tried, or else TRY_GEN_TEMPNAME returns -1. */
  extern int try_tempname (char *tmpl, int suffixlen, void *args,
-                          int (*try) (char *, void *));
+                          int (*tryfunc) (char *, void *));
 +extern int try_tempname_len (char *tmpl, int suffixlen, void *args,
-+                             int (*try) (char *, void *), size_t x_suffix_len);
++                             int (*tryfunc) (char *, void *), size_t x_suffix_len);
 
  #endif /* GL_TEMPNAME_H */
diff --git a/gnulib b/gnulib
index 6e0e31c..3333251 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 6e0e31c383c86e297bfbb8dae89515b0587a1b15
+Subproject commit 33332517845ba0e95c5be192f8812a1426b86cee
diff --git a/src/local.mk b/src/local.mk
index 19152f0..5a3b1b3 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -278,7 +278,7 @@ src_uptime_LDADD += $(GETLOADAVG_LIBS)
 
 # for various ACL functions
 copy_ldadd += $(LIB_ACL)
-src_ls_LDADD += $(LIB_ACL)
+src_ls_LDADD += $(LIB_HAS_ACL)
 
 # for various xattr functions
 copy_ldadd += $(LIB_XATTR)
-- 
2.1.0





Information forwarded to bug-coreutils <at> gnu.org:
bug#20312; Package coreutils. (Sun, 12 Apr 2015 16:53:04 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Gruenbacher <andreas.gruenbacher <at> gmail.com>
To: bug-gnulib <at> gnu.org,
	bug-coreutils <at> gnu.org
Subject: [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





Forcibly Merged 20310 20312. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Sun, 12 Apr 2015 19:28:02 GMT) Full text and rfc822 format available.

Forcibly Merged 20310 20311 20312 20666 20667 20696. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Sun, 31 May 2015 00:31:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 20310 <at> debbugs.gnu.org and Pádraig Brady <P <at> draigBrady.com> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Sun, 31 May 2015 00:31:05 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Jun 2015 11:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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