Package: fakeroot
Version: 1.20.2
Severity: normal
Tags: patch
fakeroot fails to build under OS X 10.10 due to
1) introduced openat(2)
2) changed prototype of [gs]etpriority
Attached patches fix those issues (and make openat(2) forwarding more
correct).
-- System Information:
Debian Release: 7.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to
en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
From d67f168080229bdfda9e07fc473fd699ed76a001 Mon Sep 17 00:00:00 2001
From: Mikhail Gusarov dotted...@dottedmag.net
Date: Fri, 24 Oct 2014 17:36:15 +0200
Subject: [PATCH 1/2] Implement openat(2) wrapper which handles optional
argument
Unbreaks build on OS X 10.10
---
libfakeroot.c | 16
wrapfunc.inp | 2 +-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/libfakeroot.c b/libfakeroot.c
index f867758..cd0be84 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -2426,3 +2426,19 @@ int sysinfo(int command, char *buf, long count)
}
}
#endif
+
+#ifdef HAVE_OPENAT
+int openat(int dir_fd, const char *pathname, int flags, ...)
+{
+if (flags O_CREAT)
+{
+va_list args;
+mode_t mode;
+va_start(args, flags);
+mode = va_arg(args, int);
+va_end(args);
+return next_openat(dir_fd, pathname, flags, mode);
+}
+return next_openat(dir_fd, pathname, flags);
+}
+#endif
diff --git a/wrapfunc.inp b/wrapfunc.inp
index 5eff0cc..88bcc11 100644
--- a/wrapfunc.inp
+++ b/wrapfunc.inp
@@ -197,7 +197,7 @@ fchownat;int;(int dir_fd, const char *path, uid_t owner, gid_t group, int flags)
mkdirat;int;(int dir_fd, const char *pathname, mode_t mode);(dir_fd, pathname, mode)
#endif /* HAVE_MKDIRAT */
#ifdef HAVE_OPENAT
-openat;int;(int dir_fd, const char *pathname, int flags);(dir_fd, pathname, flags)
+openat;int;(int dir_fd, const char *pathname, int flags, ...)
#endif /* HAVE_OPENAT */
#ifdef HAVE_RENAMEAT
renameat;int;(int olddir_fd, const char *oldpath, int newdir_fd, const char *newpath);(olddir_fd, oldpath, newdir_fd, newpath)
--
2.1.2
From 3f8997db8d4905acc432c019d4d850726f522031 Mon Sep 17 00:00:00 2001
From: Mikhail Gusarov dotted...@dottedmag.net
Date: Fri, 24 Oct 2014 17:53:27 +0200
Subject: [PATCH 2/2] OS X 10.10 introduced id_t != int in [gs]etpriority
---
libfakeroot.c | 11 +--
wrapfunc.inp | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/libfakeroot.c b/libfakeroot.c
index cd0be84..15fdd1d 100644
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -110,8 +110,16 @@
#define INT_NEXT_FSTATAT(a,b,c,d) NEXT_FSTATAT(_STAT_VER,a,b,c,d)
#define INT_SEND_STAT(a,b) SEND_STAT(a,b,_STAT_VER)
#define INT_SEND_GET_XATTR(a,b) SEND_GET_XATTR(a,b,_STAT_VER)
+
+/* 10.10 uses id_t in getpriority/setpriority calls, so pretend
+ id_t is used everywhere, just happens to be int on some OSes */
+#ifndef _ID_T
+#define _ID_T
+typedef int id_t;
+#endif
#endif
+#include sys/types.h
#include stdlib.h
#include sys/ipc.h
#include sys/msg.h
@@ -123,7 +131,6 @@
#include unistd.h
#include dirent.h
#include errno.h
-#include sys/types.h
#ifdef HAVE_SYS_ACL_H
#include sys/acl.h
#endif /* HAVE_SYS_ACL_H */
@@ -1894,7 +1901,7 @@ ssize_t fremovexattr(int fd, const char *name)
}
#endif /* HAVE_FREMOVEXATTR */
-int setpriority(int which, int who, int prio){
+int setpriority(int which, id_t who, int prio){
if (fakeroot_disabled)
return next_setpriority(which, who, prio);
next_setpriority(which, who, prio);
diff --git a/wrapfunc.inp b/wrapfunc.inp
index 88bcc11..0403d45 100644
--- a/wrapfunc.inp
+++ b/wrapfunc.inp
@@ -145,7 +145,7 @@ setfsgid;gid_t;(gid_t fsgid);(fsgid)
#endif /* HAVE_SETFSGID */
initgroups;int;(const char *user, INITGROUPS_SECOND_ARG group);(user, group)
setgroups;int;(SETGROUPS_SIZE_TYPE size, const gid_t *list);(size, list)
-setpriority;int;(int which, int who, int prio);(which, who, prio)
+setpriority;int;(int which, id_t who, int prio);(which, who, prio)
#ifdef HAVE_CAPSET
capset;int;(cap_user_header_t hdrp, const cap_user_data_t datap);(hdrp, datap)
#endif /* HAVE_CAPSET */
--
2.1.2