Package: fakeroot
Version: 1.20-3+dyson1
Severity: normal

Dear Maintainer,

please find a patch which makes fakeroot work perfectly on Dyson (Debian port
to the illumos (OpenSolaris) kernel) [1].

The attached patch makes three things:

1. Report errors from dlsym() only when debug is enabled. Since ACL functions
are not in libc or ld.so they are usually not found and illumos ld.so creates
noise.

2. Better detect ACL functions. Both Linux and illumos have acl_t and it's not
enough to check only this type. configure.ac patched to search ACL functions in
libacl (linux) and libsec (illumos).

3. Adds wrappers for illumos ACLs functions to fix bugs [2].

Also build dependencies should be fixed:
Build-Depends: sharutils,
 libacl1-dev [!illumos-any],
 libsec-dev [illumos-any],
 libcap-dev [linux-any],
 libcap2-bin [linux-any]





[1] http://osdyson.org
[2] http://osdyson.org/issues/167



-- System Information:
Debian Release: bok
Architecture: illumos-amd64 (i86pc)

Kernel: SunOS 5.11
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash

Versions of packages fakeroot depends on:
ii  libc1        2.10+12
ii  libfakeroot  1.20-3+dyson1

fakeroot recommends no packages.

fakeroot suggests no packages.

-- no debconf information
Description: support for illumos (solaris) ACLs
 This patch makes GNU coreutils shut up and stops GNU sed
 making files with 0000 permissions.
Bug-Dyson: http://osdyson.org/issues/167
Author: Igor Pashev <pashev.i...@gmail.com>

Index: fakeroot-1.20/libfakeroot.c
===================================================================
--- fakeroot-1.20.orig/libfakeroot.c	2014-01-27 21:22:04.000000000 +0400
+++ fakeroot-1.20/libfakeroot.c	2014-01-28 13:28:26.030053499 +0400
@@ -256,10 +256,12 @@
  /* clear dlerror() just in case dlsym() legitimately returns NULL */
     msg = dlerror();
     *(next_wrap[i].doit)=dlsym(get_libc(), next_wrap[i].name);
+#ifdef LIBFAKEROOT_DEBUGGING
+    /* illumos libc creates noise if symbols is not found (e. g. acl_get())*/
     if ( (msg = dlerror()) != NULL){
       fprintf (stderr, "dlsym(%s): %s\n", next_wrap[i].name, msg);
-/*    abort ();*/
     }
+#endif /* LIBFAKEROOT_DEBUGGING */
   }
 }
 
@@ -1916,6 +1918,9 @@
 }
 
 #ifdef HAVE_ACL_T
+
+/* linux: */
+#ifdef HAVE_ACL_GET_FD
 acl_t acl_get_fd(int fd) {
   errno = ENOTSUP;
   return (acl_t)NULL;
@@ -1928,12 +1933,51 @@
   errno = ENOTSUP;
   return -1;
 }
-
 int acl_set_file(const char *path_p, acl_type_t type, acl_t acl) {
   errno = ENOTSUP;
   return -1;
 }
-#endif /* HAVE_SYS_ACL_H */
+#endif /* HAVE_ACL_GET_FD */
+
+/* illumos: */
+#ifdef HAVE_ACL_TRIVIAL
+int acl_get(const char *path, int flags, acl_t **aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl_get(int fd, int flags, acl_t **aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int acl_set(const char *path, acl_t *aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl_set(int fd, acl_t *aclp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int acl_trivial(const char *path)
+{
+    return 0;
+}
+int acl(const char *path, int cmd, int cnt, void *buf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+int facl(int fd, int cmd, int cnt, void *buf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+#endif /* HAVE_ACL_TRIVIAL */
+
+#endif /* HAVE_ACL_T */
 
 #ifdef HAVE_FTS_READ
 FTSENT *fts_read(FTS *ftsp) {
Index: fakeroot-1.20/configure.ac
===================================================================
--- fakeroot-1.20.orig/configure.ac	2013-09-20 17:54:24.000000000 +0400
+++ fakeroot-1.20/configure.ac	2014-01-28 13:04:59.067226109 +0400
@@ -288,6 +288,16 @@
 
 AC_CHECK_FUNCS(fchmodat fchownat fstatat mkdirat mknodat openat renameat unlinkat lchmod fgetattrlist)
 
+save_LIBS="$LIBS"
+# Linux
+AC_SEARCH_LIBS(acl_get_fd, acl)
+AC_CHECK_FUNCS(acl_get_fd)
+
+# Illumos
+AC_SEARCH_LIBS(acl_trivial, sec)
+AC_CHECK_FUNCS(acl_trivial)
+LIBS="$save_LIBS"
+
 AC_CHECK_FUNCS(capset listxattr llistxattr flistxattr getxattr lgetxattr fgetxattr setxattr lsetxattr fsetxattr removexattr lremovexattr fremovexattr)
 
 dnl find out how stat() etc are called. On linux systems, we really
Index: fakeroot-1.20/wrapfunc.inp
===================================================================
--- fakeroot-1.20.orig/wrapfunc.inp	2013-09-20 17:54:24.000000000 +0400
+++ fakeroot-1.20/wrapfunc.inp	2014-01-28 13:22:39.411221945 +0400
@@ -208,10 +208,24 @@
 #endif /* HAVE_FSTATAT */
 
 #ifdef HAVE_ACL_T
+
+#ifdef HAVE_ACL_GET_FD
 acl_get_fd;acl_t;(int fd);(fd)
 acl_get_file;acl_t;(const char *path_p, acl_type_t type);(path_p, type)
 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)
+#endif
+
+#ifdef HAVE_ACL_TRIVIAL
+acl_get;int;(const char *path, int flags, acl_t **aclp);(path, flags, aclp)
+facl_get;int;(int fd, int flags, acl_t **aclp);(fd, flags, aclp)
+acl_set;int;(const char *path, acl_t *aclp);(path, aclp)
+facl_set;int;(int fd, acl_t *aclp);(fd, aclp)
+acl_trivial;int;(const char *path);(path)
+acl;int;(const char *path, int cmd, int cnt, void *buf);(path, cmd, cnt, buf)
+facl;int;(int fd, int cmd, int cnt, void *buf);(fd, cmd, cnt, buf)
+#endif
+
 #endif /* HAVE_ACL_T */
 
 #ifdef HAVE_FTS_READ

Reply via email to