On 30/06/15 20:00, Andreas Grünbacher wrote:
> Pádraig,
> 
> thanks for looking into this.
> 
> 2015-06-30 14:32 GMT+02:00 Pádraig Brady <[email protected]>:
>> The crux of the patch is to set the acl_no_supported flag
>> when getting permissions and get such an errno.
> 
> That's not how this should work; the flag is there for set_permissions
> internal use. The source and target file may have different kinds of
> acl support. In get_permissions, when acls are not supported, only
> ctx->mode should be set. In set_permissions, we try to set_acls the
> first time. If that fails, set_acls sets the acls_not_supported flag.
> It is then retried and the flag tells it to try setting the acls based
> on ctx->mode. This is needed on systems which support different kinds
> of acls on different file systems.
> 
> Whether failing to set an acl is an error or not depends on the acl:
> if the acl is equivalent to the file mode, we can just do a chmod
> instead; otherwise, we are losing information, and we need to tell the
> user. See the "nontrivial" functions in the code.
> 
> I've tried to get a recent version of Solaris running inside qemu/kvm
> so I can debug  these problems myself, unfortunately with no luck. I
> haven't had time to try FreeBSD yet.

Have you tried Assaf Gordon's preconfigured VMs?
I see FreeBSD and OpenIndiana there:
http://lists.gnu.org/archive/html/bug-gnulib/2014-10/msg00003.html

>> Also I've reinstated the acl_from_mode() replacement
>> in set-permissions.c which was ignored due to defines in acl-internal.h
> 
> Hmm, what's using that? It can't be set_permissions: that still errors
> out when HAVE_ACL_FROM_TEXT isn't defined, which is when
> rpl_acl_from_mode is defined.
> 
> acl_from_mode() cannot fail because of lack of acl support on a file
> system, it doesn't access the file system. It shouldn't affect the
> acls_not_supported flag.

OK thanks for the info.
The attached minimal patch also passes all tests on FreeBSD 9.1

cheers,
Pádraig.

From 550d438c444b256b943c30e5070238191afe8b22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Tue, 30 Jun 2015 20:35:26 +0100
Subject: [PATCH] acl: fix definition of acl_from_mode on FreeBSD

This was causing basic coreutils copy operations to fail
with ENOTSUP or ENOENT error messages.

* lib/acl-internal.h (acl_from_mode): Only define when
! defined HAVE_ACL_FROM_TEXT.  That allows the version
of acl_from_mode() defined in lib/set-permissions.c to
be used on FreeBSD at least.
* lib/set-permissions.c: Fix up comment spelling,
and a redundant variable assignment; noticed in passing.
---
 lib/acl-internal.h    | 6 ++----
 lib/set-permissions.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index d592a75..4f042ad 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -127,10 +127,8 @@ rpl_acl_set_fd (int fd, acl_t acl)
 #   define acl_extended_file(name) (-1)
 #  endif
 
-/* Linux-specific */
-#  ifndef HAVE_ACL_FROM_MODE
-#   define HAVE_ACL_FROM_MODE false
-#   define acl_from_mode(mode) (NULL)
+#  if ! defined HAVE_ACL_FROM_MODE && ! defined HAVE_ACL_FROM_TEXT
+#   define acl_from_mode (NULL)
 #  endif
 
 /* Set to 0 if a file's mode is stored independently from the ACL.  */
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 3bcfd31..8569a20 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -801,10 +801,9 @@ set_permissions (struct permission_context *ctx, const char *name, int desc)
       int saved_errno = ret ? errno : 0;
 
       /* If we can't set an acl which we expect to be able to set, try setting
-	 the permissions to ctx->mode. Doe to possible inherited permissions,
+	 the permissions to ctx->mode. Due to possible inherited permissions,
 	 we cannot simply chmod.  */
 
-      acls_set = false;
       ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set);
       if (! acls_set)
 	must_chmod = true;
-- 
2.4.1

Reply via email to