Jim,
This proposed patch fixes the copy-file testsuite failures on Tru64.
Three problems had to be handled:
- The ACL related functions are in libpacl.a, not in libacl as on Linux.
- The acl_get_fd and acl_set_fd functions conform to an older draft
(draft 13) of the abandoned POSIX spec. They take one more argument.
Furthermore they are defined as macros - which makes it harder to define
a replacement.
- The acl_free function is only applicable to an 'acl_t', not to a 'char *'.
A function acl_free_text exists for the latter.
OK to commit?
2008-05-22 Bruno Haible <[EMAIL PROTECTED]>
Add support for ACLs on OSF/1.
* lib/acl-internal.h (acl_get_fd, acl_set_fd): New inline function
replacements.
(acl_free_text): New macro fallback.
* lib/acl_entries.c (acl_entries): Use acl_free_text instead of
acl_free.
* m4/acl.m4 (gl_FUNC_ACL): Look also in libpacl library. Test for
acl_free_text function. Require AC_C_INLINE.
From 11fcb6f8e305ba3f73ab14c7a2737702722c57f2 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[EMAIL PROTECTED]>
Date: Fri, 23 May 2008 03:48:39 +0200
Subject: [PATCH] Add support for ACLs on OSF/1.
---
ChangeLog | 11 +++++++++++
lib/acl-internal.h | 33 +++++++++++++++++++++++++++++++--
lib/acl_entries.c | 4 ++--
m4/acl.m4 | 8 +++++---
4 files changed, 49 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9d1de6..5bc446d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-05-22 Bruno Haible <[EMAIL PROTECTED]>
+ Add support for ACLs on OSF/1.
+ * lib/acl-internal.h (acl_get_fd, acl_set_fd): New inline function
+ replacements.
+ (acl_free_text): New macro fallback.
+ * lib/acl_entries.c (acl_entries): Use acl_free_text instead of
+ acl_free.
+ * m4/acl.m4 (gl_FUNC_ACL): Look also in libpacl library. Test for
+ acl_free_text function. Require AC_C_INLINE.
+
+2008-05-22 Bruno Haible <[EMAIL PROTECTED]>
+
Make copy_acl work on MacOS X 10.5.
* lib/acl-internal.h (MODE_INSIDE_ACL): New macro.
(ACL_NOT_WELL_SUPPORTED): On MacOS X, also handle ENOENT.
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 75bca17..eeedc74 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -59,19 +59,48 @@
#endif
/* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_GET_FD
+#ifdef HAVE_ACL_GET_FD
+/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
+ macro(!). */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline acl_t
+rpl_acl_get_fd (int fd)
+{
+ return acl_get_fd (fd, ACL_TYPE_ACCESS);
+}
+# undef acl_get_fd
+# define acl_get_fd rpl_acl_get_fd
+# endif
+#else
# define HAVE_ACL_GET_FD false
# undef acl_get_fd
# define acl_get_fd(fd) (NULL)
#endif
/* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_SET_FD
+#ifdef HAVE_ACL_SET_FD
+/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
+ macro(!). */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline int
+rpl_acl_set_fd (int fd, acl_t acl)
+{
+ return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
+}
+# undef acl_set_fd
+# define acl_set_fd rpl_acl_set_fd
+# endif
+#else
# define HAVE_ACL_SET_FD false
# undef acl_set_fd
# define acl_set_fd(fd, acl) (-1)
#endif
+/* POSIX 1003.1e (draft 13) */
+#if ! HAVE_ACL_FREE_TEXT
+# define acl_free_text(buf) acl_free (buf)
+#endif
+
/* Linux-specific */
#ifndef HAVE_ACL_EXTENDED_FILE
# define HAVE_ACL_EXTENDED_FILE false
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index 43c752d..cd3c38b 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -1,6 +1,6 @@
/* Return the number of entries in an ACL.
- Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,6 @@ acl_entries (acl_t acl)
return -1;
for (t = text; *t; t++)
entries += (*t == '\n');
- acl_free (text);
+ acl_free_text (text);
return entries;
}
diff --git a/m4/acl.m4 b/m4/acl.m4
index 4eadab5..de76616 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,5 +1,5 @@
# acl.m4 - check for access control list (ACL) primitives
-# serial 4
+# serial 6
# Copyright (C) 2002, 2004-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -16,6 +16,7 @@ AC_DEFUN([gl_FUNC_ACL],
LIB_ACL=
use_acl=0
+ AC_REQUIRE([AC_C_INLINE])
if test "x$enable_acl" != "xno"; then
dnl Prerequisites of lib/acl.c.
AC_CHECK_HEADERS(sys/acl.h)
@@ -29,7 +30,8 @@ AC_DEFUN([gl_FUNC_ACL],
AC_CHECK_FUNCS([acl_trivial])],
[AC_CHECK_FUNCS([acl_trivial])
if test $ac_cv_func_acl_trivial != yes; then
- AC_SEARCH_LIBS([acl_get_file], [acl],
+ dnl -lacl is needed on Linux, -lpacl is needed on OSF/1.
+ AC_SEARCH_LIBS([acl_get_file], [acl pacl],
[test "$ac_cv_search_acl_get_file" = "none required" ||
LIB_ACL=$ac_cv_search_acl_get_file
AC_CHECK_FUNCS(
@@ -38,7 +40,7 @@ AC_DEFUN([gl_FUNC_ACL],
acl_delete_def_file acl_extended_file \
acl_delete_fd_np acl_delete_file_np \
acl_copy_ext_native acl_create_entry_np \
- acl_to_short_text])
+ acl_to_short_text acl_free_text])
if test $ac_cv_func_acl_get_file = yes; then
# If the acl_get_file bug is detected, disable all ACL support.
gl_ACL_GET_FILE( , [use_acl=0])
--
1.5.4.1