summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRepository mirror & CI <repomirrorci@gentoo.org>2021-04-19 21:19:59 +0000
committerRepository mirror & CI <repomirrorci@gentoo.org>2021-04-19 21:19:59 +0000
commita24d6615c81cd11714eb8ec5d0a5374a2e2cd69b (patch)
tree13d480ac9c2c832525db371a019cf2cbd4e4fde7
parent2021-04-19 21:09:49 UTC (diff)
parentsys-apps/fakechroot: fix build with glibc-2.33 (diff)
downloadgentoo-a24d6615c81cd11714eb8ec5d0a5374a2e2cd69b.tar.gz
gentoo-a24d6615c81cd11714eb8ec5d0a5374a2e2cd69b.tar.bz2
gentoo-a24d6615c81cd11714eb8ec5d0a5374a2e2cd69b.zip
Merge updates from master
-rw-r--r--app-emulation/open-vm-tools/files/11.2.5-glib-2.68.patch12
-rw-r--r--app-emulation/open-vm-tools/open-vm-tools-11.2.5_p17337674.ebuild1
-rw-r--r--sys-apps/fakechroot/fakechroot-2.20.1.ebuild4
-rw-r--r--sys-apps/fakechroot/files/fakechroot-2.20.1-glibc-2.33.patch469
-rw-r--r--sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild3
-rw-r--r--sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch413
6 files changed, 902 insertions, 0 deletions
diff --git a/app-emulation/open-vm-tools/files/11.2.5-glib-2.68.patch b/app-emulation/open-vm-tools/files/11.2.5-glib-2.68.patch
new file mode 100644
index 000000000000..1e35f6cb673b
--- /dev/null
+++ b/app-emulation/open-vm-tools/files/11.2.5-glib-2.68.patch
@@ -0,0 +1,12 @@
+--- a/open-vm-tools/lib/include/tracer.hh 2021-04-19 16:42:19.967147908 -0400
++++ b/open-vm-tools/lib/include/tracer.hh 2021-04-19 16:42:27.364829692 -0400
+@@ -28,9 +28,7 @@
+
+ #include "vm_basic_defs.h"
+
+-extern "C" {
+ #include "glib.h"
+-}
+
+
+ #ifdef VMX86_DEVEL
diff --git a/app-emulation/open-vm-tools/open-vm-tools-11.2.5_p17337674.ebuild b/app-emulation/open-vm-tools/open-vm-tools-11.2.5_p17337674.ebuild
index b67d57a32133..3ba72787b09b 100644
--- a/app-emulation/open-vm-tools/open-vm-tools-11.2.5_p17337674.ebuild
+++ b/app-emulation/open-vm-tools/open-vm-tools-11.2.5_p17337674.ebuild
@@ -69,6 +69,7 @@ S="${WORKDIR}/${MY_P}"
PATCHES=(
"${FILESDIR}/10.1.0-mount.vmhgfs.patch"
"${FILESDIR}/10.1.0-Werror.patch"
+ "${FILESDIR}/11.2.5-glib-2.68.patch"
)
pkg_setup() {
diff --git a/sys-apps/fakechroot/fakechroot-2.20.1.ebuild b/sys-apps/fakechroot/fakechroot-2.20.1.ebuild
index 75ca647e8b96..f5bfa37c4782 100644
--- a/sys-apps/fakechroot/fakechroot-2.20.1.ebuild
+++ b/sys-apps/fakechroot/fakechroot-2.20.1.ebuild
@@ -13,6 +13,10 @@ KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 ~sparc x86"
RESTRICT="test"
+PATCHES=(
+ "${FILESDIR}/fakechroot-2.20.1-glibc-2.33.patch"
+)
+
src_configure() {
econf --disable-static
}
diff --git a/sys-apps/fakechroot/files/fakechroot-2.20.1-glibc-2.33.patch b/sys-apps/fakechroot/files/fakechroot-2.20.1-glibc-2.33.patch
new file mode 100644
index 000000000000..31c2dd784393
--- /dev/null
+++ b/sys-apps/fakechroot/files/fakechroot-2.20.1-glibc-2.33.patch
@@ -0,0 +1,469 @@
+From 534e6d555736b97211523970d378dfb0db2608e9 Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Mon, 22 Feb 2021 21:44:07 -0800
+Subject: [PATCH 1/6] tmpnam.c: fix heap overflow
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ src/tmpnam.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/tmpnam.c b/src/tmpnam.c
+index ce60817..917ee6b 100644
+--- a/src/tmpnam.c
++++ b/src/tmpnam.c
+@@ -42,7 +42,7 @@ wrapper(tmpnam, char *, (char * s))
+
+ expand_chroot_path(ptr);
+
+- ptr2 = malloc(strlen(ptr));
++ ptr2 = malloc(strlen(ptr) + 1);
+ if (ptr2 == NULL) return NULL;
+
+ strcpy(ptr2, ptr);
+
+From 75d7e6fa191c11a791faff06a0de86eaa7801d05 Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Mon, 22 Feb 2021 21:46:36 -0800
+Subject: [PATCH 2/6] declare missing bufs, remove ver from lstat
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ src/lstat.c | 8 +++++---
+ src/lstat.h | 2 +-
+ src/mknod.c | 2 ++
+ src/stat.c | 2 ++
+ src/stat64.c | 2 ++
+ 5 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/lstat.c b/src/lstat.c
+index 3f6d819..54e3263 100644
+--- a/src/lstat.c
++++ b/src/lstat.c
+@@ -28,9 +28,11 @@
+ #include "lstat.h"
+
+
+-wrapper(lstat, int, (int ver, const char * filename, struct stat * buf))
++wrapper(lstat, int, (const char * filename, struct stat * buf))
+ {
+- debug("lstat(%d, \"%s\", &buf)", ver, filename);
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
++ debug("lstat(\"%s\", &buf)", filename);
+
+ if (!fakechroot_localdir(filename)) {
+ if (filename != NULL) {
+@@ -40,7 +42,7 @@ wrapper(lstat, int, (int ver, const char * filename, struct stat * buf))
+ }
+ }
+
+- return lstat_rel(ver, filename, buf);
++ return lstat_rel(filename, buf);
+ }
+
+
+diff --git a/src/lstat.h b/src/lstat.h
+index 751c1ea..ee48303 100644
+--- a/src/lstat.h
++++ b/src/lstat.h
+@@ -26,7 +26,7 @@
+
+ #ifndef HAVE___LXSTAT
+
+-wrapper_proto(lstat, int, (int, const char *, struct stat *));
++wrapper_proto(lstat, int, (const char *, struct stat *));
+
+ int lstat_rel(const char *, struct stat *);
+
+diff --git a/src/mknod.c b/src/mknod.c
+index 52fd33b..2771037 100644
+--- a/src/mknod.c
++++ b/src/mknod.c
+@@ -28,6 +28,8 @@
+
+ wrapper(mknod, int, (const char * pathname, mode_t mode, dev_t dev))
+ {
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
+ debug("mknod(\"%s\", 0%o, %ld)", pathname, mode, dev);
+ expand_chroot_path(pathname);
+ return nextcall(mknod)(pathname, mode, dev);
+diff --git a/src/stat.c b/src/stat.c
+index 7845662..7b37793 100644
+--- a/src/stat.c
++++ b/src/stat.c
+@@ -33,6 +33,8 @@
+
+ wrapper(stat, int, (const char * file_name, struct stat * buf))
+ {
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
+ debug("stat(\"%s\", &buf)", file_name);
+ expand_chroot_path(file_name);
+ return nextcall(stat)(file_name, buf);
+diff --git a/src/stat64.c b/src/stat64.c
+index aac9c75..a360f66 100644
+--- a/src/stat64.c
++++ b/src/stat64.c
+@@ -34,6 +34,8 @@
+
+ wrapper(stat64, int, (const char * file_name, struct stat64 * buf))
+ {
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
+ debug("stat64(\"%s\", &buf)", file_name);
+ expand_chroot_path(file_name);
+ return nextcall(stat64)(file_name, buf);
+
+From 693a3597ea7fccfb62f357503ff177bd3e3d5a89 Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Mon, 22 Feb 2021 21:47:09 -0800
+Subject: [PATCH 3/6] fix glibc 2.33+ compatibility
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ configure.ac | 20 ++++++++++++++++++++
+ src/ftw.c | 2 +-
+ src/ftw64.c | 14 +++++++++++---
+ src/libfakechroot.h | 15 +++++++++++++++
+ src/lstat.c | 2 +-
+ src/lstat.h | 2 +-
+ src/lstat64.c | 2 +-
+ src/mknod.c | 2 +-
+ src/mknodat.c | 2 +-
+ src/stat.c | 2 +-
+ src/stat64.c | 2 +-
+ 11 files changed, 54 insertions(+), 11 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f8cdb32..9cc2e77 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -75,6 +75,26 @@ ACX_CHECK_C_ATTRIBUTE_VISIBILITY
+ # Checks for libraries.
+ AC_CHECK_LIB([dl], [dlsym])
+
++AH_TEMPLATE([NEW_GLIBC], [glibc >= 2.33])
++AC_MSG_CHECKING([for glibc 2.33+])
++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++ #include <sys/stat.h>
++ ]], [[
++#ifdef __GLIBC__
++#if !__GLIBC_PREREQ(2,33)
++#error glibc<2.33
++#endif
++#else
++#error not glibc
++#endif
++ ]])],[
++ AC_DEFINE(NEW_GLIBC,1)
++ AC_MSG_RESULT([yes])
++ ],[
++ AC_DEFINE(NEW_GLIBC,0)
++ AC_MSG_RESULT([no])
++ ])
++
+ # Checks for header files.
+ AC_HEADER_DIRENT
+ AC_HEADER_STDC
+diff --git a/src/ftw.c b/src/ftw.c
+index 92fc126..a9abc85 100644
+--- a/src/ftw.c
++++ b/src/ftw.c
+@@ -185,7 +185,7 @@ int rpl_lstat (const char *, struct stat *);
+ # define NFTW_NEW_NAME __new_nftw
+ # define INO_T ino_t
+ # define STAT stat
+-# ifdef _LIBC
++# if defined(_LIBC) && !NEW_GLIBC
+ # define LXSTAT __lxstat
+ # define XSTAT __xstat
+ # define FXSTATAT __fxstatat
+diff --git a/src/ftw64.c b/src/ftw64.c
+index 7cc8cdf..cee1f2b 100644
+--- a/src/ftw64.c
++++ b/src/ftw64.c
+@@ -18,6 +18,8 @@
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
++#include "config.h"
++
+ #define __FTW64_C
+ #define FTW_NAME ftw64
+ #define NFTW_NAME nftw64
+@@ -25,9 +27,15 @@
+ #define NFTW_NEW_NAME __new_nftw64
+ #define INO_T ino64_t
+ #define STAT stat64
+-#define LXSTAT __lxstat64
+-#define XSTAT __xstat64
+-#define FXSTATAT __fxstatat64
++#if NEW_GLIBC
++# define LXSTAT(V,f,sb) lstat64 (f,sb)
++# define XSTAT(V,f,sb) stat64 (f,sb)
++# define FXSTATAT(V,d,f,sb,m) fstatat64 (d, f, sb, m)
++#else
++# define LXSTAT __lxstat64
++# define XSTAT __xstat64
++# define FXSTATAT __fxstatat64
++#endif
+ #define FTW_FUNC_T __ftw64_func_t
+ #define NFTW_FUNC_T __nftw64_func_t
+
+diff --git a/src/libfakechroot.h b/src/libfakechroot.h
+index 4cf199f..64ff15f 100644
+--- a/src/libfakechroot.h
++++ b/src/libfakechroot.h
+@@ -200,6 +200,21 @@
+ # endif
+ #endif
+
++#ifndef _STAT_VER
++ #if defined (__aarch64__)
++ #define _STAT_VER 0
++ #elif defined (__powerpc__) && __WORDSIZE == 64
++ #define _STAT_VER 1
++ #elif defined (__riscv) && __riscv_xlen==64
++ #define _STAT_VER 0
++ #elif defined (__s390x__)
++ #define _STAT_VER 1
++ #elif defined (__x86_64__)
++ #define _STAT_VER 1
++ #else
++ #define _STAT_VER 3
++ #endif
++#endif
+
+ typedef void (*fakechroot_wrapperfn_t)(void);
+
+diff --git a/src/lstat.c b/src/lstat.c
+index 54e3263..fa38323 100644
+--- a/src/lstat.c
++++ b/src/lstat.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#ifndef HAVE___LXSTAT
++#if !defined(HAVE___LXSTAT) || NEW_GLIBC
+
+ #include <sys/stat.h>
+ #include <unistd.h>
+diff --git a/src/lstat.h b/src/lstat.h
+index ee48303..c46a2b9 100644
+--- a/src/lstat.h
++++ b/src/lstat.h
+@@ -24,7 +24,7 @@
+ #include <config.h>
+ #include "libfakechroot.h"
+
+-#ifndef HAVE___LXSTAT
++#if !defined(HAVE___LXSTAT) || NEW_GLIBC
+
+ wrapper_proto(lstat, int, (const char *, struct stat *));
+
+diff --git a/src/lstat64.c b/src/lstat64.c
+index b6212fc..a332d7c 100644
+--- a/src/lstat64.c
++++ b/src/lstat64.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#if defined(HAVE_LSTAT64) && !defined(HAVE___LXSTAT64)
++#if defined(HAVE_LSTAT64) && (!defined(HAVE___LXSTAT64) || NEW_GLIBC)
+
+ #define _LARGEFILE64_SOURCE
+ #define _BSD_SOURCE
+diff --git a/src/mknod.c b/src/mknod.c
+index 2771037..aeb750b 100644
+--- a/src/mknod.c
++++ b/src/mknod.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#ifndef HAVE___XMKNOD
++#if !defined(HAVE___XMKNOD) || NEW_GLIBC
+
+ #include <sys/stat.h>
+ #include "libfakechroot.h"
+diff --git a/src/mknodat.c b/src/mknodat.c
+index 732a22b..3239b35 100644
+--- a/src/mknodat.c
++++ b/src/mknodat.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#if defined(HAVE_MKNODAT) && !defined(HAVE___XMKNODAT)
++#if defined(HAVE_MKNODAT) && (!defined(HAVE___XMKNODAT) || NEW_GLIBC)
+
+ #define _ATFILE_SOURCE
+ #include <sys/stat.h>
+diff --git a/src/stat.c b/src/stat.c
+index 7b37793..5ef57ba 100644
+--- a/src/stat.c
++++ b/src/stat.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#ifndef HAVE___XSTAT
++#if !defined(HAVE___XSTAT) || NEW_GLIBC
+
+ #define _BSD_SOURCE
+ #define _DEFAULT_SOURCE
+diff --git a/src/stat64.c b/src/stat64.c
+index a360f66..993ce80 100644
+--- a/src/stat64.c
++++ b/src/stat64.c
+@@ -20,7 +20,7 @@
+
+ #include <config.h>
+
+-#if defined(HAVE_STAT64) && !defined(HAVE___XSTAT64)
++#if defined(HAVE_STAT64) && (!defined(HAVE___XSTAT64) || NEW_GLIBC)
+
+ #define _BSD_SOURCE
+ #define _LARGEFILE64_SOURCE
+
+From e7c1f3a446e594a4d0cce5f5d499c9439ce1d5c5 Mon Sep 17 00:00:00 2001
+From: neok-m4700 <neok-m4700@users.noreply.github.com>
+Date: Wed, 24 Feb 2021 17:36:57 +0100
+Subject: [PATCH 6/6] wrap fstatat and fstatat64
+
+---
+ configure.ac | 2 ++
+ src/Makefile.am | 2 ++
+ src/fstatat.c | 42 ++++++++++++++++++++++++++++++++++++++++++
+ src/fstatat64.c | 43 +++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 89 insertions(+)
+ create mode 100644 src/fstatat.c
+ create mode 100644 src/fstatat64.c
+
+diff --git a/configure.ac b/configure.ac
+index 9cc2e77..5b3053e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -218,6 +218,8 @@ AC_CHECK_FUNCS(m4_normalize([
+ freopen64
+ fstat
+ fstat64
++ fstatat
++ fstatat64
+ fts_children
+ fts_open
+ fts_read
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 6066345..eb311c0 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -61,6 +61,8 @@ libfakechroot_la_SOURCES = \
+ fopen64.c \
+ freopen.c \
+ freopen64.c \
++ fstatat.c \
++ fstatat64.c \
+ fts.c \
+ fts64.c \
+ ftw.c \
+diff --git a/src/fstatat.c b/src/fstatat.c
+new file mode 100644
+index 0000000..ca7578b
+--- /dev/null
++++ b/src/fstatat.c
+@@ -0,0 +1,42 @@
++/*
++ libfakechroot -- fake chroot environment
++ Copyright (c) 2010, 2021 Piotr Roszatycki <dexter@debian.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++*/
++
++
++#include <config.h>
++
++#ifdef HAVE_FSTATAT
++
++#define _ATFILE_SOURCE
++#define _POSIX_C_SOURCE 200809L
++#include <sys/stat.h>
++#include <limits.h>
++#include "libfakechroot.h"
++
++wrapper(fstatat, int, (int dirfd, const char *pathname, struct stat *buf, int flags))
++{
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
++ debug("fstatat(%d, \"%s\", &buf, %d)", dirfd, pathname, flags);
++ expand_chroot_path_at(dirfd, pathname);
++ return nextcall(fstatat)(dirfd, pathname, buf, flags);
++}
++
++#else
++typedef int empty_translation_unit;
++#endif
+diff --git a/src/fstatat64.c b/src/fstatat64.c
+new file mode 100644
+index 0000000..1863372
+--- /dev/null
++++ b/src/fstatat64.c
+@@ -0,0 +1,43 @@
++/*
++ libfakechroot -- fake chroot environment
++ Copyright (c) 2010, 2021 Piotr Roszatycki <dexter@debian.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++*/
++
++
++#include <config.h>
++
++#ifdef HAVE_FSTATAT64
++
++#define _ATFILE_SOURCE
++#define _POSIX_C_SOURCE 200809L
++#define _LARGEFILE64_SOURCE
++#include <sys/stat.h>
++#include <limits.h>
++#include "libfakechroot.h"
++
++wrapper(fstatat64, int, (int dirfd, const char *pathname, struct stat64 *buf, int flags))
++{
++ char fakechroot_abspath[FAKECHROOT_PATH_MAX];
++ char fakechroot_buf[FAKECHROOT_PATH_MAX];
++ debug("fstatat64(%d, \"%s\", &buf, %d)", dirfd, pathname, flags);
++ expand_chroot_path_at(dirfd, pathname);
++ return nextcall(fstatat64)(dirfd, pathname, buf, flags);
++}
++
++#else
++typedef int empty_translation_unit;
++#endif
diff --git a/sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild b/sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild
index c0cdb4acf90d..9d4a2363ab6e 100644
--- a/sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild
+++ b/sys-apps/fakeroot/fakeroot-1.25.3-r1.ebuild
@@ -24,6 +24,9 @@ BDEPEND="app-text/po4a"
DOCS=( AUTHORS BUGS DEBUG README doc/README.saving )
src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}/fakeroot-1.25.3-glibc-2.33.patch"
+ )
default
eautoreconf
}
diff --git a/sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch b/sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch
new file mode 100644
index 000000000000..87ae9e18b746
--- /dev/null
+++ b/sys-apps/fakeroot/files/fakeroot-1.25.3-glibc-2.33.patch
@@ -0,0 +1,413 @@
+From 03bc0ee07fb6e293d081ffd8af1654788b434f6a Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Thu, 11 Feb 2021 20:59:25 -0800
+Subject: [PATCH 1/6] libfakeroot.c: define _STAT_VER if not already defined
+
+Based on patch from Jan Pazdziora:
+https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ libfakeroot.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/libfakeroot.c b/libfakeroot.c
+index 3e80e38..14cdbc4 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -90,6 +90,16 @@
+ #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
+ #endif
+
++#ifndef _STAT_VER
++ #if defined (__aarch64__)
++ #define _STAT_VER 0
++ #elif defined (__x86_64__)
++ #define _STAT_VER 1
++ #else
++ #define _STAT_VER 3
++ #endif
++#endif
++
+ /*
+ These INT_* (which stands for internal) macros should always be used when
+ the fakeroot library owns the storage of the stat variable.
+--
+GitLab
+
+
+From feda578ca3608b7fc9a28a3a91293611c0ef47b7 Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Thu, 11 Feb 2021 21:00:04 -0800
+Subject: [PATCH 2/6] libfakeroot.c: add wrappers for new glibc 2.33+ symbols
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ libfakeroot.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+
+diff --git a/libfakeroot.c b/libfakeroot.c
+index 14cdbc4..d75c51f 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -1352,6 +1352,54 @@ int renameat(int olddir_fd, const char *oldpath,
+ #endif /* HAVE_FSTATAT */
+
+
++#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
++/* Glibc 2.33 exports symbols for these functions in the shared lib */
++ int lstat(const char *file_name, struct stat *statbuf) {
++ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
++ }
++ int stat(const char *file_name, struct stat *st) {
++ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st);
++ }
++ int fstat(int fd, struct stat *st) {
++ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st);
++ }
++
++ #ifdef HAVE_FSTATAT
++ int fstatat(int dir_fd, const char *path, struct stat *st, int flags) {
++ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags);
++ }
++ #endif
++
++ #ifdef STAT64_SUPPORT
++ int lstat64(const char *file_name, struct stat64 *st) {
++ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st);
++ }
++ int stat64(const char *file_name, struct stat64 *st) {
++ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st);
++ }
++ int fstat64(int fd, struct stat64 *st) {
++ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st);
++ }
++
++ #ifdef HAVE_FSTATAT
++ int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) {
++ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags);
++ }
++ #endif
++ #endif
++
++ int mknod(const char *pathname, mode_t mode, dev_t dev) {
++ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev);
++ }
++
++ #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT)
++ int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) {
++ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
++ }
++ #endif
++#endif /* GLIBC_PREREQ */
++
++
+ #ifdef FAKEROOT_FAKENET
+ pid_t fork(void)
+ {
+--
+GitLab
+
+
+From d074aaa34d6928989308a3870738d6b1c28f2bae Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Thu, 11 Feb 2021 21:00:20 -0800
+Subject: [PATCH 3/6] libfakeroot.c: fix compile error with DEBUG enabled
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ libfakeroot.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libfakeroot.c b/libfakeroot.c
+index d75c51f..31480f8 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -2525,7 +2525,7 @@ int statx (int dirfd, const char *path, int flags, unsigned int mask, struct sta
+
+ #ifdef LIBFAKEROOT_DEBUGGING
+ if (fakeroot_debug) {
+- fprintf(stderr, "statx fd %d\n", fd);
++ fprintf(stderr, "statx fd %d\n", dirfd);
+ }
+ #endif /* LIBFAKEROOT_DEBUGGING */
+ r=INT_NEXT_FSTATAT(dirfd, path, &st, flags);
+--
+GitLab
+
+
+From c3eebec293e35b997bb46c22fb5a4e114afb5e7f Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Sat, 13 Feb 2021 19:32:08 -0800
+Subject: [PATCH 4/6] configure.ac: fix __xmknod{,at} pointer argument
+
+Switch default to assume * and not the absence of *.
+
+On glibc 2.33+, there is no definition for these functions in header
+files, so the compile test doesn't work. But, we can default to using
+the pointer (as is the case with newer glibc), and use the header file
+on older platforms to fail the test and use no pointer.
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ configure.ac | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 73415d2..d85566f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -183,13 +183,13 @@ AC_MSG_CHECKING([for type of arg of __xmknod])
+ ]], [[
+ int __xmknod ( int ver,
+ const char *pathname ,
+- mode_t mode , dev_t dev);
++ mode_t mode , dev_t *dev);
+ ]])],[
+- AC_DEFINE(XMKNOD_FRTH_ARG,)
+- AC_MSG_RESULT([no extra *])
+- ],[
+ AC_DEFINE(XMKNOD_FRTH_ARG,[*])
+ AC_MSG_RESULT([needs *])
++ ],[
++ AC_DEFINE(XMKNOD_FRTH_ARG,)
++ AC_MSG_RESULT([no extra *])
+
+ ])
+
+@@ -210,13 +210,13 @@ AC_MSG_CHECKING([for type of arg of __xmknodat])
+ int __xmknodat ( int ver,
+ int dirfd,
+ const char *pathname ,
+- mode_t mode , dev_t dev);
++ mode_t mode , dev_t *dev);
+ ]])],[
+- AC_DEFINE(XMKNODAT_FIFTH_ARG,)
+- AC_MSG_RESULT([no extra *])
+- ],[
+ AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
+ AC_MSG_RESULT([needs *])
++ ],[
++ AC_DEFINE(XMKNODAT_FIFTH_ARG,)
++ AC_MSG_RESULT([no extra *])
+
+ ])
+
+--
+GitLab
+
+
+From 01671986b4ee8eb76dc7f63dfe034a7faf4a4c28 Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Sat, 13 Feb 2021 19:35:31 -0800
+Subject: [PATCH 5/6] libfakeroot.c: fix fts_read and fts_children
+
+Apply Debian patch from [0], since glibc is usually built without LFS.
+__USE_LARGEFILE64 and FTSENT64 should be used anyway for proper support
+of this, if needed. See [1] for more details.
+
+[0]: https://sources.debian.org/patches/fakeroot/1.25.3-1.1/eglibc-fts-without-LFS/
+[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=676428
+
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ libfakeroot.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/libfakeroot.c b/libfakeroot.c
+index 31480f8..169f4da 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -2066,11 +2066,7 @@ FTSENT *fts_read(FTS *ftsp) {
+ || r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
+ r->fts_statp = NULL; /* Otherwise fts_statp may be a random pointer */
+ if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
+-# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
+- SEND_GET_STAT64(r->fts_statp, _STAT_VER);
+-# else
+ SEND_GET_STAT(r->fts_statp, _STAT_VER);
+-# endif
+ }
+
+ return r;
+@@ -2089,11 +2085,7 @@ FTSENT *fts_children(FTS *ftsp, int options) {
+ first=next_fts_children(ftsp, options);
+ for(r = first; r; r = r->fts_link) {
+ if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
+-# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
+- SEND_GET_STAT64(r->fts_statp, _STAT_VER);
+-# else
+ SEND_GET_STAT(r->fts_statp, _STAT_VER);
+-# endif
+ }
+ }
+
+--
+GitLab
+
+
+From f5e0a89ab6f0024f3d3bec5fd9cf631676b44f6c Mon Sep 17 00:00:00 2001
+From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+Date: Sat, 13 Feb 2021 20:05:17 -0800
+Subject: [PATCH 6/6] OS X portability
+
+OS X portability work from OpenWrt.
+
+Cc: Felix Fietkau <nbd@nbd.name>
+Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
+---
+ configure.ac | 1 +
+ libfakeroot.c | 36 ++++++++++++++++++++++++++++++++++--
+ wrapawk_macosx | 10 +++++++---
+ wrapfunc.inp | 4 ++--
+ 4 files changed, 44 insertions(+), 7 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index d85566f..35f9ecf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -146,6 +146,7 @@ for first in size_t int; do
+ #include <sys/types.h>
+ #endif
+ #include <unistd.h>
++#include <stdio.h>
+ #ifdef HAVE_GRP_H
+ #include <grp.h>
+ #endif
+diff --git a/libfakeroot.c b/libfakeroot.c
+index 169f4da..7593dd6 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -122,8 +122,16 @@
+ #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)
+ #define INT_SEND_GET_STAT(a,b) SEND_GET_STAT(a,b)
++
++/* 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>
+@@ -135,7 +143,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 */
+@@ -198,6 +205,15 @@ extern int unsetenv (const char *name);
+ #undef __lxstat64
+ #undef _FILE_OFFSET_BITS
+
++
++#ifndef AT_EMPTY_PATH
++#define AT_EMPTY_PATH 0
++#endif
++
++#ifndef AT_NO_AUTOMOUNT
++#define AT_NO_AUTOMOUNT 0
++#endif
++
+ /*
+ // next_wrap_st:
+ // this structure is used in next_wrap, which is defined in
+@@ -1969,7 +1985,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);
+@@ -2570,3 +2586,19 @@ int sysinfo(int command, char *buf, long count)
+ }
+ }
+ #endif
++
++#ifdef HAVE_OPENAT
++int openat(int dir_fd, const char *pathname, int flags, ...)
++{
++ mode_t mode;
++
++ if (flags & O_CREAT) {
++ va_list args;
++ va_start(args, flags);
++ mode = va_arg(args, int);
++ va_end(args);
++ }
++
++ return next_openat(dir_fd, pathname, flags, mode);
++}
++#endif
+diff --git a/wrapawk_macosx b/wrapawk_macosx
+index 088a7f4..f783219 100644
+--- a/wrapawk_macosx
++++ b/wrapawk_macosx
+@@ -46,26 +46,30 @@ BEGIN{
+ argtype=$3;
+ argname=$4;
+ MACRO=$5;
++ argtype_def=$6
++ if(!argtype_def) {
++ argtype_def = argtype
++ }
+ if(MACRO){
+ print "extern " ret " MY_DEF(" name ")" argtype " __attribute__((visibility(\"hidden\")));" > headerfile;
+ print "INTERPOSE(MY_DEF(" name "_RAW)," name "_RAW);" > structfile;
+ print "#undef " name > deffile
+ print "#define " name " MY_DEF(" name "_RAW)" > deffile
+
+- print "extern " ret, name, argtype ";" > tmpffile;
++ print "extern " ret, name, argtype_def ";" > tmpffile;
+ print "static __inline__ " ret " NEXT_" MACRO "_NOARG " argtype " __attribute__((always_inline));" > tmpffile;
+ print "static __inline__ " ret " NEXT_" MACRO "_NOARG " argtype " {" > tmpffile;
+ print " return " name, argname ";" > tmpffile;
+ print "}" > tmpffile;
+ print "" > tmpffile;
+ } else {
+- print "extern " ret " my_" name, argtype " __attribute__((visibility(\"hidden\")));" > headerfile;
++ print "extern " ret " my_" name, argtype_def " __attribute__((visibility(\"hidden\")));" > headerfile;
+ print "#undef " name > structfile;
+ print "INTERPOSE(my_" name "," name ");" > structfile;
+ print "#define " name " my_" name > structfile
+ print "#define " name " my_" name > deffile
+
+- print "extern " ret, name, argtype ";" > tmpffile;
++ print "extern " ret, name, argtype_def ";" > tmpffile;
+ if(argname){
+ print "static __inline__ " ret " next_" name, argtype " __attribute__((always_inline));" > tmpffile;
+ print "static __inline__ " ret " next_" name, argtype " {" > tmpffile;
+diff --git a/wrapfunc.inp b/wrapfunc.inp
+index f7ad186..556af34 100644
+--- a/wrapfunc.inp
++++ b/wrapfunc.inp
+@@ -146,7 +146,7 @@ setfsgid;gid_t;(gid_t fsgid);(fsgid)
+ initgroups;int;(const char *user, INITGROUPS_SECOND_ARG group);(user, group)
+ getgroups;int;(int size, gid_t list[]);(size, list)
+ 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 */
+@@ -198,7 +198,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, mode_t mode);(dir_fd, pathname, flags, mode);;(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)
+--
+GitLab
+