From 06d3319b76c394412cf4da2f1b3e51627ac4aa46 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 6 Sep 2011 10:38:52 +0200 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ lib/acl-internal.h | 2 +- lib/copy-acl.c | 10 +++------- lib/set-mode-acl.c | 14 +++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00576191b..01a68e888 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-09-06 Bruno Haible + + 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. + 2011-09-05 Paul Eggert openat: port to AIX 7.1 with large files diff --git a/lib/acl-internal.h b/lib/acl-internal.h index aade05570..4f7166e4e 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -146,7 +146,7 @@ rpl_acl_set_fd (int fd, acl_t acl) /* 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 diff --git a/lib/copy-acl.c b/lib/copy-acl.c index 030c4bfc9..1532cb81a 100644 --- a/lib/copy-acl.c +++ b/lib/copy-acl.c @@ -45,7 +45,7 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name, #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 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name, 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 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name, } 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 diff --git a/lib/set-mode-acl.c b/lib/set-mode-acl.c index 7e12d571e..3954c297a 100644 --- a/lib/set-mode-acl.c +++ b/lib/set-mode-acl.c @@ -57,7 +57,7 @@ qset_acl (char const *name, int desc, mode_t mode) # 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 @@ qset_acl (char const *name, int desc, mode_t mode) 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 -- 2.11.0