I wrote a small workaround for this bug: It claims that the underlying
filesystem does not support ACL whenever fakeroot is running and the
acl_set_{fd,file} functions are called. This fixes cp -a (and probably
all coreutils). The patch is attached, it fixes the problems we had with
makepkg on Archlinux.
Some explanation of the bug: Newer coreutils (if compiled with ACL
support) always try to set the file permissions using ACL instead of
chmod when cp -p is run. The lack of support for ACLs and/or extended
attributes (which are used to store ACLs) in fakeroot leads to
unspecified behaviour.
A long-term solution would be the implementation of either ACLs or
xattrs in fakeroot. Note that the implementation of xattrs would
automatically make ACLs work as far as I can see.
diff -Nur fakeroot-1.8.10.orig/libfakeroot.c fakeroot-1.8.10/libfakeroot.c
--- fakeroot-1.8.10.orig/libfakeroot.c 2007-11-21 15:41:08.000000000 +0100
+++ fakeroot-1.8.10/libfakeroot.c 2008-01-04 14:04:44.000000000 +0100
@@ -57,6 +57,8 @@
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/acl.h>
#if !HAVE_DECL_SETENV
extern int setenv (const char *name, const char *value, int replace);
@@ -1461,3 +1463,13 @@
{
return fakeroot_disabled;
}
+
+int acl_set_fd(int fd, acl_t acl) {
+ errno = ENOTSUP;
+ return -1;
+}
+
+int acl_set_file(const char *path_p, acl_type_t type, acl_t acl) {
+ errno = ENOTSUP;
+ return -1;
+}
diff -Nur fakeroot-1.8.10.orig/wrapfunc.inp fakeroot-1.8.10/wrapfunc.inp
--- fakeroot-1.8.10.orig/wrapfunc.inp 2007-11-21 22:55:56.000000000 +0100
+++ fakeroot-1.8.10/wrapfunc.inp 2008-01-04 13:59:17.000000000 +0100
@@ -123,4 +123,5 @@
#endif /* HAVE_UNLINKAT */
#endif /* HAVE_FSTATAT */
-
+acl_set_fd;int;(int fd, acl_t acl);(fd, acl)
+acl_set_file;int;(const char *path_p, acl_type_t type, acl_t acl);(path_p,
type, acl)