bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils-8.12.178-df9cd on Solaris 10


From: Bruno Haible
Subject: Re: coreutils-8.12.178-df9cd on Solaris 10
Date: Tue, 6 Sep 2011 00:27:41 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

> The change to lib/set-mode-acl.c fixed the first test failure. For the
> second test failure, I'm applying this fix:

And finally, clean up the pieces of unused Solaris code:


2011-09-05  Bruno Haible  <address@hidden>

        acl: Clean up Solaris code.
        * lib/acl-internal.h: Remove no-op #if.
        * lib/file-has-acl.c: Likewise.
        * lib/set-mode-acl.c (qset_acl): Remove unused Solaris code.
        * lib/copy-acl.c (qcopy_acl): Likewise.

--- lib/acl-internal.h.orig     Tue Sep  6 00:23:04 2011
+++ lib/acl-internal.h  Tue Sep  6 00:03:11 2011
@@ -183,14 +183,10 @@
 #   define MODE_INSIDE_ACL 1
 #  endif
 
-#  if !(defined ACL_NO_TRIVIAL && 0) /* Solaris <= 10, Cygwin */
-
 /* Return 1 if the given ACL is non-trivial.
    Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
 extern int acl_nontrivial (int count, aclent_t *entries);
 
-#  endif
-
 #  ifdef ACE_GETACL /* Solaris 10 */
 
 /* Test an ACL retrieved with ACE_GETACL.
--- lib/copy-acl.c.orig Tue Sep  6 00:23:04 2011
+++ lib/copy-acl.c      Tue Sep  6 00:03:11 2011
@@ -181,57 +181,20 @@
 
 #elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
 
-# if defined ACL_NO_TRIVIAL && 0
-  /* Solaris 10 (newer version), which has additional API declared in
-     <sys/acl.h> (acl_t) and implemented in libsec (acl_set, acl_trivial,
-     acl_fromtext, ...).  */
-
-  int ret;
-  acl_t *aclp = NULL;
-  ret = (source_desc < 0
-         ? acl_get (src_name, ACL_NO_TRIVIAL, &aclp)
-         : facl_get (source_desc, ACL_NO_TRIVIAL, &aclp));
-  if (ret != 0 && errno != ENOSYS)
-    return -2;
-
-  ret = qset_acl (dst_name, dest_desc, mode);
-  if (ret != 0)
-    return -1;
-
-  if (aclp)
-    {
-      ret = (dest_desc < 0
-             ? acl_set (dst_name, aclp)
-             : facl_set (dest_desc, aclp));
-      if (ret != 0)
-        {
-          int saved_errno = errno;
-
-          acl_free (aclp);
-          errno = saved_errno;
-          return -1;
-        }
-      acl_free (aclp);
-    }
-
-  return 0;
-
-# else /* Solaris, Cygwin, general case */
-
   /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
      of Unixware.  The acl() call returns the access and default ACL both
      at once.  */
-#  ifdef ACE_GETACL
+# ifdef ACE_GETACL
   int ace_count;
   ace_t *ace_entries;
-#  endif
+# endif
   int count;
   aclent_t *entries;
   int did_chmod;
   int saved_errno;
   int ret;
 
-#  ifdef ACE_GETACL
+# ifdef ACE_GETACL
   /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
      file systems (whereas the other ones are used in UFS file systems).
      There is an API
@@ -284,7 +247,7 @@
       /* Huh? The number of ACL entries changed since the last call.
          Repeat.  */
     }
-#  endif
+# endif
 
   for (;;)
     {
@@ -327,9 +290,9 @@
     }
 
   /* Is there an ACL of either kind?  */
-#  ifdef ACE_GETACL
+# ifdef ACE_GETACL
   if (ace_count == 0)
-#  endif
+# endif
     if (count == 0)
       return qset_acl (dst_name, dest_desc, mode);
 
@@ -367,7 +330,7 @@
     }
   free (entries);
 
-#  ifdef ACE_GETACL
+# ifdef ACE_GETACL
   if (ace_count > 0)
     {
       ret = (dest_desc != -1
@@ -382,7 +345,7 @@
         }
     }
   free (ace_entries);
-#  endif
+# endif
 
   if (MODE_INSIDE_ACL
       && did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
@@ -404,8 +367,6 @@
     }
   return 0;
 
-# endif
-
 #elif USE_ACL && HAVE_GETACL /* HP-UX */
 
   int count;
--- lib/file-has-acl.c.orig     Tue Sep  6 00:23:04 2011
+++ lib/file-has-acl.c  Tue Sep  6 00:03:11 2011
@@ -120,8 +120,6 @@
 
 #elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
 
-# if !(defined ACL_NO_TRIVIAL && 0) /* Solaris <= 10, Cygwin */
-
 /* Test an ACL retrieved with GETACL.
    Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
    Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.  */
@@ -148,7 +146,7 @@
   return 0;
 }
 
-#  ifdef ACE_GETACL
+# ifdef ACE_GETACL
 
 /* Test an ACL retrieved with ACE_GETACL.
    Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
@@ -300,8 +298,6 @@
   return 0;
 }
 
-#  endif
-
 # endif
 
 #elif USE_ACL && HAVE_GETACL /* HP-UX */
--- lib/set-mode-acl.c.orig     Tue Sep  6 00:23:04 2011
+++ lib/set-mode-acl.c  Tue Sep  6 00:03:11 2011
@@ -203,56 +203,9 @@
 
 # elif HAVE_FACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */
 
-#  if defined ACL_NO_TRIVIAL && 0
-  /* Solaris 10 (newer version), which has additional API declared in
-     <sys/acl.h> (acl_t) and implemented in libsec (acl_set, acl_trivial,
-     acl_fromtext, ...).  */
-
-  acl_t *aclp;
-  char acl_text[] = "user::---,group::---,mask:---,other:---";
-  int ret;
-  int saved_errno;
-
-  if (mode & S_IRUSR) acl_text[ 6] = 'r';
-  if (mode & S_IWUSR) acl_text[ 7] = 'w';
-  if (mode & S_IXUSR) acl_text[ 8] = 'x';
-  if (mode & S_IRGRP) acl_text[17] = acl_text[26] = 'r';
-  if (mode & S_IWGRP) acl_text[18] = acl_text[27] = 'w';
-  if (mode & S_IXGRP) acl_text[19] = acl_text[28] = 'x';
-  if (mode & S_IROTH) acl_text[36] = 'r';
-  if (mode & S_IWOTH) acl_text[37] = 'w';
-  if (mode & S_IXOTH) acl_text[38] = 'x';
-
-  if (acl_fromtext (acl_text, &aclp) != 0)
-    {
-      errno = ENOMEM;
-      return -1;
-    }
-
-  ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp));
-  saved_errno = errno;
-  acl_free (aclp);
-  if (ret < 0)
-    {
-      if (saved_errno == ENOSYS || saved_errno == EOPNOTSUPP)
-        return chmod_or_fchmod (name, desc, mode);
-      errno = saved_errno;
-      return -1;
-    }
-
-  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
-    {
-      /* We did not call chmod so far, so the special bits have not yet
-         been set.  */
-      return chmod_or_fchmod (name, desc, mode);
-    }
-  return 0;
-
-#  else /* Solaris, Cygwin, general case */
-
   int done_setacl = 0;
 
-#   ifdef ACE_GETACL
+#  ifdef ACE_GETACL
   /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
      file systems (whereas the other ones are used in UFS file systems).  */
 
@@ -419,7 +372,7 @@
       if (ret == 0)
         done_setacl = 1;
     }
-#   endif
+#  endif
 
   if (!done_setacl)
     {
@@ -458,8 +411,6 @@
     }
   return 0;
 
-#  endif
-
 # elif HAVE_GETACL /* HP-UX */
 
   struct stat statbuf;
-- 
In memoriam Moshe Weinberg <http://en.wikipedia.org/wiki/Moshe_Weinberg>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]