Fix error: '_STAT_VER' undeclared

This commit is contained in:
sxt1001 2021-03-13 15:21:20 +08:00
parent cef339a066
commit 388d222657
5 changed files with 191 additions and 1 deletions

View File

@ -0,0 +1,69 @@
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] 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)
{

View File

@ -0,0 +1,34 @@
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] 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.

View File

@ -0,0 +1,57 @@
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] 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 *])
])

View File

@ -0,0 +1,23 @@
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] 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);

View File

@ -2,7 +2,7 @@
Summary: Gives a fake root environment Summary: Gives a fake root environment
Name: fakeroot Name: fakeroot
Version: 1.25.2 Version: 1.25.2
Release: 1 Release: 2
License: GPLv3+ and LGPLv2.1 and MIT and GPL+ License: GPLv3+ and LGPLv2.1 and MIT and GPL+
URL: https://tracker.debian.org/pkg/fakeroot URL: https://tracker.debian.org/pkg/fakeroot
Source0: http://salsa.debian.org/clint/fakeroot/-/archive/upstream/1.25.2/%{name}-upstream-%{version}.tar.gz Source0: http://salsa.debian.org/clint/fakeroot/-/archive/upstream/1.25.2/%{name}-upstream-%{version}.tar.gz
@ -10,6 +10,10 @@ Patch0: debian_eglibc-fts-without-LFS.patch
Patch2: debian_fix-shell-in-fakeroot.patch Patch2: debian_fix-shell-in-fakeroot.patch
Patch4: fakeroot-inttypes.patch Patch4: fakeroot-inttypes.patch
Patch5: fakeroot-multilib.patch Patch5: fakeroot-multilib.patch
Patch6000: backport-define-_STAT_VER-if-not-already-defined.patch
Patch6001: backport-add-wrappers-for-new-glibc-2.33+-symbols.patch
Patch6002: backport-fix-compile-error-with-DEBUG-enabled.patch
Patch6003: backport-fix-__xmknod-at-pointer-argument.patch
%if %{with autoconf} %if %{with autoconf}
BuildRequires: autoconf automake libtool po4a BuildRequires: autoconf automake libtool po4a
%endif %endif
@ -125,6 +129,9 @@ fi
%ghost %{_libdir}/libfakeroot/libfakeroot-0.so %ghost %{_libdir}/libfakeroot/libfakeroot-0.so
%changelog %changelog
* Sat Mar 13 2021 shixuantong <shixuantong@huawei.com> - 1.25.2-2
- Fix error: '_STAT_VER' undeclared
* Fri Nov 20 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.25.2-1 * Fri Nov 20 2020 zhangjiapeng <zhangjiapeng9@huawei.com> - 1.25.2-1
- Update to 1.25.2 - Update to 1.25.2