Subject: bug#20312: [COREUTILS 1/2] build: updated gnulib acl handling

From: Andreas Gruenbacher <[email-masked]>
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