bug-gnulib
[Top][All Lists]
Advanced

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

ACLs on IRIX


From: Bruno Haible
Subject: ACLs on IRIX
Date: Tue, 6 Sep 2011 10:41:49 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

>       acl: Try unit tests on more file systems.
>       * tests/test-file-has-acl-1.sh: New file.
>       * tests/test-file-has-acl-2.sh: New file.
>       * tests/test-set-mode-acl-1.sh: New file.
>       * tests/test-set-mode-acl-2.sh: New file.
>       * tests/test-copy-acl-1.sh: New file.
>       * tests/test-copy-acl-2.sh: New file.
>       * modules/acl-tests (Files): Add them.
>       (Makefile.am): Add them to TESTS.

These new tests uncover a test failure on IRIX 6.5:

  mode = 700: tmpfile1 has wrong mode: -rw-------
  FAIL: test-set-mode-acl-2.sh

Apparently the mode is part of the ACL for local file systems, but not for NFS.
On NFS, acl_set_file succeeds but does not change the file's mode.
This fixes it.


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

        acl: Fix a test failure on IRIX 6.5 with NFS.
        * lib/acl-internal.h (MODE_INSIDE_ACL): Define to 0 on IRIX.
        * lib/set-mode-acl.c (qset_acl): Test !HAVE_ACL_TYPE_EXTENDED instead
        of MODE_INSIDE_ACL. If !MODE_INSIDE_ACL, do a chmod_or_fchmod always.
        * lib/copy-acl.c (qcopy_acl): Likewise.

--- lib/acl-internal.h.orig     Tue Sep  6 10:35:17 2011
+++ lib/acl-internal.h  Tue Sep  6 10:29:16 2011
@@ -146,7 +146,7 @@
 
 /* Set to 1 if a file's mode is implicit by the ACL.
    Set to 0 if a file's mode is stored independently from the ACL.  */
-#  if HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP /* MacOS X */
+#  if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi 
/* MacOS X, IRIX */
 #   define MODE_INSIDE_ACL 0
 #  else
 #   define MODE_INSIDE_ACL 1
--- lib/copy-acl.c.orig Tue Sep  6 10:35:18 2011
+++ lib/copy-acl.c      Tue Sep  6 10:31:15 2011
@@ -45,7 +45,7 @@
 #if USE_ACL && HAVE_ACL_GET_FILE
   /* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
   /* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
-# if MODE_INSIDE_ACL
+# if !HAVE_ACL_TYPE_EXTENDED
   /* Linux, FreeBSD, IRIX, Tru64 */
 
   acl_t acl;
@@ -87,7 +87,7 @@
   else
     acl_free (acl);
 
-  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
+  if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
     {
       /* We did not call chmod so far, and either the mode and the ACL are
          separate or special bits are to be set which don't fit into ACLs.  */
@@ -115,13 +115,9 @@
     }
   return 0;
 
-# else /* !MODE_INSIDE_ACL */
+# else /* HAVE_ACL_TYPE_EXTENDED */
   /* MacOS X */
 
-#  if !HAVE_ACL_TYPE_EXTENDED
-#   error Must have ACL_TYPE_EXTENDED
-#  endif
-
   /* On MacOS X,  acl_get_file (name, ACL_TYPE_ACCESS)
      and          acl_get_file (name, ACL_TYPE_DEFAULT)
      always return NULL / EINVAL.  You have to use
--- lib/set-mode-acl.c.orig     Tue Sep  6 10:35:18 2011
+++ lib/set-mode-acl.c  Tue Sep  6 10:31:15 2011
@@ -57,7 +57,7 @@
 # if HAVE_ACL_GET_FILE
   /* POSIX 1003.1e draft 17 (abandoned) specific version.  */
   /* Linux, FreeBSD, MacOS X, IRIX, Tru64 */
-#  if MODE_INSIDE_ACL
+#  if !HAVE_ACL_TYPE_EXTENDED
   /* Linux, FreeBSD, IRIX, Tru64 */
 
   /* We must also have acl_from_text and acl_delete_def_file.
@@ -132,21 +132,17 @@
   if (S_ISDIR (mode) && acl_delete_def_file (name))
     return -1;
 
-  if (mode & (S_ISUID | S_ISGID | S_ISVTX))
+  if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
     {
-      /* We did not call chmod so far, so the special bits have not yet
-         been set.  */
+      /* We did not call chmod so far, and either the mode and the ACL are
+         separate or special bits are to be set which don't fit into ACLs.  */
       return chmod_or_fchmod (name, desc, mode);
     }
   return 0;
 
-#  else /* !MODE_INSIDE_ACL */
+#  else /* HAVE_ACL_TYPE_EXTENDED */
   /* MacOS X */
 
-#   if !HAVE_ACL_TYPE_EXTENDED
-#    error Must have ACL_TYPE_EXTENDED
-#   endif
-
   /* On MacOS X,  acl_get_file (name, ACL_TYPE_ACCESS)
      and          acl_get_file (name, ACL_TYPE_DEFAULT)
      always return NULL / EINVAL.  You have to use
-- 
In memoriam Andre Spitzer <http://en.wikipedia.org/wiki/Andre_Spitzer>
            Efat Ghazi <http://en.wikipedia.org/wiki/Efat_Ghazi>
            David Mark Berger <http://en.wikipedia.org/wiki/David_Mark_Berger>
            Ze'ev Friedman <http://en.wikipedia.org/wiki/Ze'ev_Friedman>
            Yossef Gutfreund <http://en.wikipedia.org/wiki/Yossef_Gutfreund>
            Eliezer Halfin <http://en.wikipedia.org/wiki/Eliezer_Halfin>
            Amitzur Shapira <http://en.wikipedia.org/wiki/Amitzur_Shapira>
            Kehat Shorr <http://en.wikipedia.org/wiki/Kehat_Shorr>
            Mark Slavin <http://en.wikipedia.org/wiki/Mark_Slavin>
            Yakov Springer <http://en.wikipedia.org/wiki/Yakov_Springer>



reply via email to

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