1 |
commit: 6713479f9affb2b5e2231d135219c16ce3f03778 |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Oct 29 03:01:49 2018 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Oct 30 01:15:25 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6713479f |
7 |
|
8 |
sys-boot/systemd-boot: glibc-2.28 compat for stat.h |
9 |
|
10 |
Closes: https://bugs.gentoo.org/669846 |
11 |
Package-Manager: Portage-2.3.51_p2, Repoman-2.3.11_p27 |
12 |
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> |
13 |
|
14 |
sys-boot/systemd-boot/files/239-stat-0.patch | 108 ++++++++++++++++++++++++++ |
15 |
sys-boot/systemd-boot/files/239-stat-1.patch | 74 ++++++++++++++++++ |
16 |
sys-boot/systemd-boot/systemd-boot-239.ebuild | 2 + |
17 |
3 files changed, 184 insertions(+) |
18 |
|
19 |
diff --git a/sys-boot/systemd-boot/files/239-stat-0.patch b/sys-boot/systemd-boot/files/239-stat-0.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..e136b703a2f |
22 |
--- /dev/null |
23 |
+++ b/sys-boot/systemd-boot/files/239-stat-0.patch |
24 |
@@ -0,0 +1,108 @@ |
25 |
+From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001 |
26 |
+From: Filipe Brandenburger <filbranden@××××××.com> |
27 |
+Date: Sun, 15 Jul 2018 22:43:35 -0700 |
28 |
+Subject: [PATCH] build-sys: Detect whether struct statx is defined in |
29 |
+ sys/stat.h |
30 |
+MIME-Version: 1.0 |
31 |
+Content-Type: text/plain; charset=UTF-8 |
32 |
+Content-Transfer-Encoding: 8bit |
33 |
+ |
34 |
+Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a |
35 |
+definition for struct statx, in which case include file linux/stat.h should be |
36 |
+avoided, in order to prevent a duplicate definition. |
37 |
+ |
38 |
+ In file included from ../src/basic/missing.h:18, |
39 |
+ from ../src/basic/util.h:28, |
40 |
+ from ../src/basic/hashmap.h:10, |
41 |
+ from ../src/shared/bus-util.h:12, |
42 |
+ from ../src/libsystemd/sd-bus/bus-creds.c:11: |
43 |
+ /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’ |
44 |
+ struct statx { |
45 |
+ ^~~~~ |
46 |
+ In file included from /usr/include/sys/stat.h:446, |
47 |
+ from ../src/basic/util.h:19, |
48 |
+ from ../src/basic/hashmap.h:10, |
49 |
+ from ../src/shared/bus-util.h:12, |
50 |
+ from ../src/libsystemd/sd-bus/bus-creds.c:11: |
51 |
+ /usr/include/bits/statx.h:36:8: note: originally defined here |
52 |
+ struct statx |
53 |
+ ^~~~~ |
54 |
+ |
55 |
+Extend our meson.build to look for struct statx when only sys/stat.h is |
56 |
+included and, in that case, do not include linux/stat.h anymore. |
57 |
+ |
58 |
+Tested that systemd builds correctly when using a glibc version that includes a |
59 |
+definition for struct statx. |
60 |
+ |
61 |
+glibc Fedora RPM update: |
62 |
+https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae |
63 |
+ |
64 |
+glibc upstream commit: |
65 |
+https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd |
66 |
+--- |
67 |
+ meson.build | 5 +++++ |
68 |
+ src/basic/missing.h | 5 ++++- |
69 |
+ src/basic/xattr-util.c | 1 - |
70 |
+ 3 files changed, 9 insertions(+), 2 deletions(-) |
71 |
+ |
72 |
+diff --git a/meson.build b/meson.build |
73 |
+index dd904c7148..68423bdfa5 100644 |
74 |
+--- a/meson.build |
75 |
++++ b/meson.build |
76 |
+@@ -425,6 +425,7 @@ decl_headers = ''' |
77 |
+ #include <sys/stat.h> |
78 |
+ ''' |
79 |
+ # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail |
80 |
++# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time |
81 |
+ |
82 |
+ foreach decl : ['char16_t', |
83 |
+ 'char32_t', |
84 |
+@@ -439,6 +440,10 @@ foreach decl : ['char16_t', |
85 |
+ conf.set10('HAVE_' + decl.underscorify().to_upper(), have) |
86 |
+ endforeach |
87 |
+ |
88 |
++conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : ''' |
89 |
++#include <sys/stat.h> |
90 |
++''', args : '-D_GNU_SOURCE') > 0) |
91 |
++ |
92 |
+ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], |
93 |
+ ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], |
94 |
+ ['IFLA_VRF_TABLE', 'linux/if_link.h'], |
95 |
+diff --git a/src/basic/missing.h b/src/basic/missing.h |
96 |
+index 71a07d0574..14ad3d4914 100644 |
97 |
+--- a/src/basic/missing.h |
98 |
++++ b/src/basic/missing.h |
99 |
+@@ -15,7 +15,6 @@ |
100 |
+ #include <linux/neighbour.h> |
101 |
+ #include <linux/oom.h> |
102 |
+ #include <linux/rtnetlink.h> |
103 |
+-#include <linux/stat.h> |
104 |
+ #include <net/ethernet.h> |
105 |
+ #include <stdlib.h> |
106 |
+ #include <sys/resource.h> |
107 |
+@@ -25,6 +24,10 @@ |
108 |
+ #include <uchar.h> |
109 |
+ #include <unistd.h> |
110 |
+ |
111 |
++#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H |
112 |
++#include <linux/stat.h> |
113 |
++#endif |
114 |
++ |
115 |
+ #if HAVE_AUDIT |
116 |
+ #include <libaudit.h> |
117 |
+ #endif |
118 |
+diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c |
119 |
+index c5c55ea846..0ee0979837 100644 |
120 |
+--- a/src/basic/xattr-util.c |
121 |
++++ b/src/basic/xattr-util.c |
122 |
+@@ -2,7 +2,6 @@ |
123 |
+ |
124 |
+ #include <errno.h> |
125 |
+ #include <fcntl.h> |
126 |
+-#include <linux/stat.h> |
127 |
+ #include <stdint.h> |
128 |
+ #include <stdlib.h> |
129 |
+ #include <string.h> |
130 |
+-- |
131 |
+2.19.1 |
132 |
+ |
133 |
|
134 |
diff --git a/sys-boot/systemd-boot/files/239-stat-1.patch b/sys-boot/systemd-boot/files/239-stat-1.patch |
135 |
new file mode 100644 |
136 |
index 00000000000..1104de3c9c1 |
137 |
--- /dev/null |
138 |
+++ b/sys-boot/systemd-boot/files/239-stat-1.patch |
139 |
@@ -0,0 +1,74 @@ |
140 |
+From 9c869d08d82c73f62ab3527567858ce4b0cf1257 Mon Sep 17 00:00:00 2001 |
141 |
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@××××××.pl> |
142 |
+Date: Wed, 18 Jul 2018 17:26:17 +0200 |
143 |
+Subject: [PATCH] meson: unify linux/stat.h check with other checks and use |
144 |
+ _GNU_SOURCE |
145 |
+ |
146 |
+Using _GNU_SOURCE is better because that's how we include the headers in the |
147 |
+actual build, and some headers define different stuff when it is defined. |
148 |
+sys/stat.h for example defines 'struct statx' conditionally. |
149 |
+--- |
150 |
+ meson.build | 20 ++++++++++++++------ |
151 |
+ src/basic/missing.h | 2 +- |
152 |
+ 2 files changed, 15 insertions(+), 7 deletions(-) |
153 |
+ |
154 |
+diff --git a/meson.build b/meson.build |
155 |
+index 68423bdfa5..99035d2306 100644 |
156 |
+--- a/meson.build |
157 |
++++ b/meson.build |
158 |
+@@ -421,11 +421,9 @@ decl_headers = ''' |
159 |
+ #include <uchar.h> |
160 |
+ #include <linux/ethtool.h> |
161 |
+ #include <linux/fib_rules.h> |
162 |
+-#include <linux/stat.h> |
163 |
+ #include <sys/stat.h> |
164 |
+ ''' |
165 |
+ # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail |
166 |
+-# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time |
167 |
+ |
168 |
+ foreach decl : ['char16_t', |
169 |
+ 'char32_t', |
170 |
+@@ -436,13 +434,23 @@ foreach decl : ['char16_t', |
171 |
+ ] |
172 |
+ |
173 |
+ # We get -1 if the size cannot be determined |
174 |
+- have = cc.sizeof(decl, prefix : decl_headers) > 0 |
175 |
++ have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
176 |
++ |
177 |
++ if decl == 'struct statx' |
178 |
++ if have |
179 |
++ want_linux_stat_h = false |
180 |
++ else |
181 |
++ have = cc.sizeof(decl, |
182 |
++ prefix : decl_headers + '#include <linux/stat.h>', |
183 |
++ args : '-D_GNU_SOURCE') > 0 |
184 |
++ want_linux_stat_h = have |
185 |
++ endif |
186 |
++ endif |
187 |
++ |
188 |
+ conf.set10('HAVE_' + decl.underscorify().to_upper(), have) |
189 |
+ endforeach |
190 |
+ |
191 |
+-conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : ''' |
192 |
+-#include <sys/stat.h> |
193 |
+-''', args : '-D_GNU_SOURCE') > 0) |
194 |
++conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
195 |
+ |
196 |
+ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], |
197 |
+ ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], |
198 |
+diff --git a/src/basic/missing.h b/src/basic/missing.h |
199 |
+index 14ad3d4914..9044683b15 100644 |
200 |
+--- a/src/basic/missing.h |
201 |
++++ b/src/basic/missing.h |
202 |
+@@ -24,7 +24,7 @@ |
203 |
+ #include <uchar.h> |
204 |
+ #include <unistd.h> |
205 |
+ |
206 |
+-#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H |
207 |
++#if WANT_LINUX_STAT_H |
208 |
+ #include <linux/stat.h> |
209 |
+ #endif |
210 |
+ |
211 |
+-- |
212 |
+2.19.1 |
213 |
+ |
214 |
|
215 |
diff --git a/sys-boot/systemd-boot/systemd-boot-239.ebuild b/sys-boot/systemd-boot/systemd-boot-239.ebuild |
216 |
index 4eb8570b73c..603415b39a0 100644 |
217 |
--- a/sys-boot/systemd-boot/systemd-boot-239.ebuild |
218 |
+++ b/sys-boot/systemd-boot/systemd-boot-239.ebuild |
219 |
@@ -38,6 +38,8 @@ S="${WORKDIR}/systemd-${PV}" |
220 |
PATCHES=( |
221 |
"${FILESDIR}/237-libshared-static.patch" |
222 |
"${FILESDIR}/239-debug-extra.patch" |
223 |
+ "${FILESDIR}/239-stat-0.patch" |
224 |
+ "${FILESDIR}/239-stat-1.patch" |
225 |
) |
226 |
|
227 |
src_configure() { |