Skip to content

Commit 0853f2c

Browse files
joerg-krauselauromoura
authored andcommitted
package/fakeroot: add upstream patches to fix glibc 2.33 compatibility
Glibc 2.33 removed `_STAT_VER`. On host machines, which updated to glibc 2.33, building host-fakeroot breaks: ``` In file included from communicate.h:20, from libfakeroot.c:60: libfakeroot.c: In function ‘chown’: libfakeroot.c:99:40: error: ‘_STAT_VER’ undeclared (first use in this function) 99 | #define INT_NEXT_STAT(a,b) NEXT_STAT64(_STAT_VER,a,b) ``` The issue has been discussed on some package maintainer threads, e.g.: https://bugs.archlinux.org/task/69572 https://bugzilla.redhat.com/show_bug.cgi?id=1889862#c13 A patch series was prepared by Ilya Lipnitskiy which included two other patches not related to the glibc 2.33 compatibility issue and submitted as merge request for upstream: https://www.mail-archive.com/[email protected]/msg57280.html Upstream accepted the merge request: https://salsa.debian.org/clint/fakeroot/-/merge_requests/10 Note, that this patch series only contains the necessay patches for glibc 2.33 compatibility. Tested on my Arch Linux machine, building a UBIFS/OverlayFS-based root filesystem for an i.MX6ULL target board. Signed-off-by: Jörg Krause <[email protected]> Tested-by: Bartosz Bilas <[email protected]> [Peter: drop patch numbering (PATCH x/y) as pointed out by check-package] Signed-off-by: Peter Korsgaard <[email protected]>
1 parent 39df928 commit 0853f2c

File tree

4 files changed

+192
-1
lines changed

4 files changed

+192
-1
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 03bc0ee07fb6e293d081ffd8af1654788b434f6a Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Thu, 11 Feb 2021 20:59:25 -0800
4+
Subject: [PATCH] libfakeroot.c: define _STAT_VER if not already defined
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
glibc 2.33 does does declare `_STAT_VER` anymore.
10+
11+
Based on patch from Jan Pazdziora:
12+
https://lists.fedoraproject.org/archives/list/[email protected]/message/SMQ3RYXEYTVZH6PLQMKNB3NM4XLPMNZO/
13+
14+
Backported from: feda578ca3608b7fc9a28a3a91293611c0ef47b7
15+
16+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
17+
Signed-off-by: Jörg Krause <[email protected]>
18+
---
19+
libfakeroot.c | 10 ++++++++++
20+
1 file changed, 10 insertions(+)
21+
22+
diff --git a/libfakeroot.c b/libfakeroot.c
23+
index 3e80e38..14cdbc4 100644
24+
--- a/libfakeroot.c
25+
+++ b/libfakeroot.c
26+
@@ -90,6 +90,16 @@
27+
#define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
28+
#endif
29+
30+
+#ifndef _STAT_VER
31+
+ #if defined (__aarch64__)
32+
+ #define _STAT_VER 0
33+
+ #elif defined (__x86_64__)
34+
+ #define _STAT_VER 1
35+
+ #else
36+
+ #define _STAT_VER 3
37+
+ #endif
38+
+#endif
39+
+
40+
/*
41+
These INT_* (which stands for internal) macros should always be used when
42+
the fakeroot library owns the storage of the stat variable.
43+
--
44+
2.30.1
45+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From feda578ca3608b7fc9a28a3a91293611c0ef47b7 Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Thu, 11 Feb 2021 21:00:04 -0800
4+
Subject: [PATCH] libfakeroot.c: add wrappers for new glibc 2.33+ symbols
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
This patch add wrappers for newly exported symbols in glibc 2.33.
10+
11+
Backported from: feda578ca3608b7fc9a28a3a91293611c0ef47b7
12+
13+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
14+
Signed-off-by: Jörg Krause <[email protected]>
15+
---
16+
libfakeroot.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
17+
1 file changed, 48 insertions(+)
18+
19+
diff --git a/libfakeroot.c b/libfakeroot.c
20+
index 14cdbc4..d75c51f 100644
21+
--- a/libfakeroot.c
22+
+++ b/libfakeroot.c
23+
@@ -1352,6 +1352,54 @@ int renameat(int olddir_fd, const char *oldpath,
24+
#endif /* HAVE_FSTATAT */
25+
26+
27+
+#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
28+
+/* Glibc 2.33 exports symbols for these functions in the shared lib */
29+
+ int lstat(const char *file_name, struct stat *statbuf) {
30+
+ return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
31+
+ }
32+
+ int stat(const char *file_name, struct stat *st) {
33+
+ return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st);
34+
+ }
35+
+ int fstat(int fd, struct stat *st) {
36+
+ return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st);
37+
+ }
38+
+
39+
+ #ifdef HAVE_FSTATAT
40+
+ int fstatat(int dir_fd, const char *path, struct stat *st, int flags) {
41+
+ return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags);
42+
+ }
43+
+ #endif
44+
+
45+
+ #ifdef STAT64_SUPPORT
46+
+ int lstat64(const char *file_name, struct stat64 *st) {
47+
+ return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st);
48+
+ }
49+
+ int stat64(const char *file_name, struct stat64 *st) {
50+
+ return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st);
51+
+ }
52+
+ int fstat64(int fd, struct stat64 *st) {
53+
+ return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st);
54+
+ }
55+
+
56+
+ #ifdef HAVE_FSTATAT
57+
+ int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) {
58+
+ return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags);
59+
+ }
60+
+ #endif
61+
+ #endif
62+
+
63+
+ int mknod(const char *pathname, mode_t mode, dev_t dev) {
64+
+ return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev);
65+
+ }
66+
+
67+
+ #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT)
68+
+ int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) {
69+
+ return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
70+
+ }
71+
+ #endif
72+
+#endif /* GLIBC_PREREQ */
73+
+
74+
+
75+
#ifdef FAKEROOT_FAKENET
76+
pid_t fork(void)
77+
{
78+
--
79+
2.30.1
80+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 432dd46e662772020306a2ce8b1be38321697e69 Mon Sep 17 00:00:00 2001
2+
From: Ilya Lipnitskiy <[email protected]>
3+
Date: Sat, 13 Feb 2021 19:32:08 -0800
4+
Subject: [PATCH] configure.ac: fix __xmknod{,at} pointer argument
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Switch default to assume * and not the absence of *.
10+
11+
On glibc 2.33+, there is no definition for these functions in header
12+
files, so the compile test doesn't work. But, we can default to using
13+
the pointer (as is the case with newer glibc), and use the header file
14+
on older platforms to fail the test and use no pointer.
15+
16+
Backported from: c3eebec293e35b997bb46c22fb5a4e114afb5e7f
17+
18+
Signed-off-by: Ilya Lipnitskiy <[email protected]>
19+
Signed-off-by: Jörg Krause <[email protected]>
20+
---
21+
configure.ac | 16 ++++++++--------
22+
1 file changed, 8 insertions(+), 8 deletions(-)
23+
24+
diff --git a/configure.ac b/configure.ac
25+
index 73415d2..d85566f 100644
26+
--- a/configure.ac
27+
+++ b/configure.ac
28+
@@ -183,13 +183,13 @@ AC_MSG_CHECKING([for type of arg of __xmknod])
29+
]], [[
30+
int __xmknod ( int ver,
31+
const char *pathname ,
32+
- mode_t mode , dev_t dev);
33+
+ mode_t mode , dev_t *dev);
34+
]])],[
35+
- AC_DEFINE(XMKNOD_FRTH_ARG,)
36+
- AC_MSG_RESULT([no extra *])
37+
- ],[
38+
AC_DEFINE(XMKNOD_FRTH_ARG,[*])
39+
AC_MSG_RESULT([needs *])
40+
+ ],[
41+
+ AC_DEFINE(XMKNOD_FRTH_ARG,)
42+
+ AC_MSG_RESULT([no extra *])
43+
44+
])
45+
46+
@@ -210,13 +210,13 @@ AC_MSG_CHECKING([for type of arg of __xmknodat])
47+
int __xmknodat ( int ver,
48+
int dirfd,
49+
const char *pathname ,
50+
- mode_t mode , dev_t dev);
51+
+ mode_t mode , dev_t *dev);
52+
]])],[
53+
- AC_DEFINE(XMKNODAT_FIFTH_ARG,)
54+
- AC_MSG_RESULT([no extra *])
55+
- ],[
56+
AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
57+
AC_MSG_RESULT([needs *])
58+
+ ],[
59+
+ AC_DEFINE(XMKNODAT_FIFTH_ARG,)
60+
+ AC_MSG_RESULT([no extra *])
61+
62+
])
63+
64+
--
65+
2.30.1
66+

package/fakeroot/fakeroot.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ HOST_FAKEROOT_DEPENDENCIES = host-acl
1515
HOST_FAKEROOT_CONF_ENV = \
1616
ac_cv_header_sys_capability_h=no \
1717
ac_cv_func_capset=no
18-
# 0003-Select-TCP-when-lack-of-SYSV-IPC.patch touches configure.ac
18+
# patching configure.ac in patch 0003
1919
HOST_FAKEROOT_AUTORECONF = YES
2020
FAKEROOT_LICENSE = GPL-3.0+
2121
FAKEROOT_LICENSE_FILES = COPYING

0 commit comments

Comments
 (0)