]> git.pld-linux.org Git - packages/systemd.git/blob - systemd-struct-statx-in-glibc.patch
- x32 buildfix patch from debian
[packages/systemd.git] / systemd-struct-statx-in-glibc.patch
1 [Fedora 0001-build-sys-Detect-whether-struct-statx-is-defined-in-.patch]
2 From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001
3 From: Filipe Brandenburger <filbranden@google.com>
4 Date: Sun, 15 Jul 2018 22:43:35 -0700
5 Subject: [PATCH] build-sys: Detect whether struct statx is defined in
6  sys/stat.h
7 MIME-Version: 1.0
8 Content-Type: text/plain; charset=UTF-8
9 Content-Transfer-Encoding: 8bit
10
11 Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
12 definition for struct statx, in which case include file linux/stat.h should be
13 avoided, in order to prevent a duplicate definition.
14
15     In file included from ../src/basic/missing.h:18,
16                      from ../src/basic/util.h:28,
17                      from ../src/basic/hashmap.h:10,
18                      from ../src/shared/bus-util.h:12,
19                      from ../src/libsystemd/sd-bus/bus-creds.c:11:
20     /usr/include/linux/stat.h:99:8: error: redefinition of ‘struct statx’
21      struct statx {
22             ^~~~~
23     In file included from /usr/include/sys/stat.h:446,
24                      from ../src/basic/util.h:19,
25                      from ../src/basic/hashmap.h:10,
26                      from ../src/shared/bus-util.h:12,
27                      from ../src/libsystemd/sd-bus/bus-creds.c:11:
28     /usr/include/bits/statx.h:36:8: note: originally defined here
29      struct statx
30             ^~~~~
31
32 Extend our meson.build to look for struct statx when only sys/stat.h is
33 included and, in that case, do not include linux/stat.h anymore.
34
35 Tested that systemd builds correctly when using a glibc version that includes a
36 definition for struct statx.
37
38 glibc Fedora RPM update:
39 https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
40
41 glibc upstream commit:
42 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
43 ---
44  meson.build            | 5 +++++
45  src/basic/missing.h    | 5 ++++-
46  src/basic/xattr-util.c | 1 -
47  3 files changed, 9 insertions(+), 2 deletions(-)
48
49 diff --git a/meson.build b/meson.build
50 index dd904c7148..68423bdfa5 100644
51 --- a/meson.build
52 +++ b/meson.build
53 @@ -425,6 +425,7 @@ decl_headers = '''
54  #include <sys/stat.h>
55  '''
56  # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
57 +# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
58  
59  foreach decl : ['char16_t',
60                  'char32_t',
61 @@ -439,6 +440,10 @@ foreach decl : ['char16_t',
62          conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
63  endforeach
64  
65 +conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
66 +#include <sys/stat.h>
67 +''', args : '-D_GNU_SOURCE') > 0)
68 +
69  foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
70                  ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
71                  ['IFLA_VRF_TABLE',                   'linux/if_link.h'],
72 diff --git a/src/basic/missing.h b/src/basic/missing.h
73 index 71a07d0574..14ad3d4914 100644
74 --- a/src/basic/missing.h
75 +++ b/src/basic/missing.h
76 @@ -15,7 +15,6 @@
77  #include <linux/neighbour.h>
78  #include <linux/oom.h>
79  #include <linux/rtnetlink.h>
80 -#include <linux/stat.h>
81  #include <net/ethernet.h>
82  #include <stdlib.h>
83  #include <sys/resource.h>
84 @@ -25,6 +24,10 @@
85  #include <uchar.h>
86  #include <unistd.h>
87  
88 +#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
89 +#include <linux/stat.h>
90 +#endif
91 +
92  #if HAVE_AUDIT
93  #include <libaudit.h>
94  #endif
95 diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
96 index c5c55ea846..0ee0979837 100644
97 --- a/src/basic/xattr-util.c
98 +++ b/src/basic/xattr-util.c
99 @@ -2,7 +2,6 @@
100  
101  #include <errno.h>
102  #include <fcntl.h>
103 -#include <linux/stat.h>
104  #include <stdint.h>
105  #include <stdlib.h>
106  #include <string.h>
This page took 0.262873 seconds and 3 git commands to generate.