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-apps/systemd/, sys-apps/systemd/files/
Date: Sun, 02 Jul 2017 15:56:52
Message-Id: 1499010973.dc1c5167bcf33b3a500b072f5c40e8c2c7ab57c4.floppym@gentoo
1 commit: dc1c5167bcf33b3a500b072f5c40e8c2c7ab57c4
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 2 15:53:46 2017 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 2 15:56:13 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc1c5167
7
8 sys-apps/systemd: fix build failure on ia64/alpha
9
10 Bug: https://bugs.gentoo.org/623536
11 Bug: https://bugs.gentoo.org/612102
12 Package-Manager: Portage-2.3.6_p9, Repoman-2.3.2_p77
13
14 sys-apps/systemd/files/233-format-warnings.patch | 84 ++++++++++++++++++++++++
15 sys-apps/systemd/systemd-233-r3.ebuild | 1 +
16 2 files changed, 85 insertions(+)
17
18 diff --git a/sys-apps/systemd/files/233-format-warnings.patch b/sys-apps/systemd/files/233-format-warnings.patch
19 new file mode 100644
20 index 00000000000..7bb08f0a320
21 --- /dev/null
22 +++ b/sys-apps/systemd/files/233-format-warnings.patch
23 @@ -0,0 +1,84 @@
24 +From 3e7d14d78c4d15ec7789299216cbf5c58e61547b Mon Sep 17 00:00:00 2001
25 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@××××××.pl>
26 +Date: Sat, 3 Jun 2017 05:41:17 -0400
27 +Subject: [PATCH] sd-bus: silence format warnings in kdbus code (#6072)
28 +MIME-Version: 1.0
29 +Content-Type: text/plain; charset=UTF-8
30 +Content-Transfer-Encoding: 8bit
31 +
32 +The code is mostly correct, but gcc is trying to outsmart us, and emits a
33 +warning for a "llu vs lu" mismatch, even though they are the same size (on alpha):
34 +
35 +src/libsystemd/sd-bus/bus-control.c: In function ‘kernel_get_list’:
36 +src/libsystemd/sd-bus/bus-control.c:267:42: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=]
37 + if (asprintf(&n, ":1.%llu", name->id) < 0) {
38 + ^
39 +src/libsystemd/sd-bus/bus-control.c: In function ‘bus_get_name_creds_kdbus’:
40 +src/libsystemd/sd-bus/bus-control.c:714:47: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=]
41 + if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) {
42 + ^
43 +This is hard to work around properly, because kdbus.h uses __u64 which is
44 +defined-differently-despite-being-the-same-size then uint64_t. Thus the simple
45 +solution of using %PRIu64 fails on amd64:
46 +
47 +src/libsystemd/sd-bus/bus-control.c:714:47: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘__u64 {aka long long unsigned int}’ [-Werror=format=]
48 + if (asprintf(&c->unique_name, ":1.%"PRIu64, conn_info->id) < 0) {
49 + ^~~~~~
50 +
51 +Let's just avoid the whole issue for now by silencing the warning.
52 +After the next release, we should just get rid of the kdbus code.
53 +
54 +Fixes #5561.
55 +---
56 + src/libsystemd/sd-bus/bus-control.c | 6 ++++++
57 + src/libsystemd/sd-bus/bus-kernel.c | 2 ++
58 + 2 files changed, 8 insertions(+)
59 +
60 +diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
61 +index 9e58ffbd8..303ae0f23 100644
62 +--- a/src/libsystemd/sd-bus/bus-control.c
63 ++++ b/src/libsystemd/sd-bus/bus-control.c
64 +@@ -264,10 +264,13 @@ static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) {
65 + if ((flags & KDBUS_LIST_UNIQUE) && name->id != previous_id && !(name->flags & KDBUS_HELLO_ACTIVATOR)) {
66 + char *n;
67 +
68 ++#pragma GCC diagnostic push
69 ++#pragma GCC diagnostic ignored "-Wformat"
70 + if (asprintf(&n, ":1.%llu", name->id) < 0) {
71 + r = -ENOMEM;
72 + goto fail;
73 + }
74 ++#pragma GCC diagnostic pop
75 +
76 + r = strv_consume(x, n);
77 + if (r < 0)
78 +@@ -711,10 +714,13 @@ int bus_get_name_creds_kdbus(
79 + }
80 +
81 + if (mask & SD_BUS_CREDS_UNIQUE_NAME) {
82 ++#pragma GCC diagnostic push
83 ++#pragma GCC diagnostic ignored "-Wformat"
84 + if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) {
85 + r = -ENOMEM;
86 + goto fail;
87 + }
88 ++#pragma GCC diagnostic pop
89 +
90 + c->mask |= SD_BUS_CREDS_UNIQUE_NAME;
91 + }
92 +diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
93 +index c82caeb3f..ca6aee7c0 100644
94 +--- a/src/libsystemd/sd-bus/bus-kernel.c
95 ++++ b/src/libsystemd/sd-bus/bus-kernel.c
96 +@@ -51,6 +51,8 @@
97 + #include "user-util.h"
98 + #include "util.h"
99 +
100 ++#pragma GCC diagnostic ignored "-Wformat"
101 ++
102 + #define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
103 +
104 + int bus_kernel_parse_unique_name(const char *s, uint64_t *id) {
105 +--
106 +2.13.2
107 +
108
109 diff --git a/sys-apps/systemd/systemd-233-r3.ebuild b/sys-apps/systemd/systemd-233-r3.ebuild
110 index 8210bd8a2f9..ab19c28efc0 100644
111 --- a/sys-apps/systemd/systemd-233-r3.ebuild
112 +++ b/sys-apps/systemd/systemd-233-r3.ebuild
113 @@ -155,6 +155,7 @@ src_prepare() {
114 local PATCHES=(
115 "${FILESDIR}/233-0001-Avoid-strict-DM-interface-version-dependencies-5519.patch"
116 "${FILESDIR}/233-CVE-2017-9445.patch"
117 + "${FILESDIR}/233-format-warnings.patch"
118 )
119
120 if ! use vanilla; then