Gentoo Archives: gentoo-commits

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