[OE-core] [PATCH 1/2] systemd: Fix build with gcc9

Khem Raj raj.khem at gmail.com
Mon May 6 17:51:35 UTC 2019


gcc9 throws additional warnings about format string overflow

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 ...-format-overflow-warnings-with-gcc-9.patch | 41 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_242.bb      |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/0006-Fix-format-overflow-warnings-with-gcc-9.patch

diff --git a/meta/recipes-core/systemd/systemd/0006-Fix-format-overflow-warnings-with-gcc-9.patch b/meta/recipes-core/systemd/systemd/0006-Fix-format-overflow-warnings-with-gcc-9.patch
new file mode 100644
index 0000000000..510ac22150
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0006-Fix-format-overflow-warnings-with-gcc-9.patch
@@ -0,0 +1,41 @@
+From c8050da8b7b0e59e4d1d0e15a92b9ecad299dbbb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Mon, 6 May 2019 10:41:15 -0700
+Subject: [PATCH] Fix format-overflow warnings with gcc-9
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+gcc-9 has become a bit stricter and can check all kind of formatted
+input/output functions which causes additional warnings when compiling
+networkd
+
+/src/basic/log.h:104:9: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
+         log_internal_realm(LOG_REALM_PLUS_LEVEL(LOG_REALM, (level)), __VA_ARGS__)
+
+see https://github.com/systemd/systemd/issues/12454
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+ src/network/networkd-link.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 533193ac93..976cbbeaaa 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -339,7 +339,8 @@ static int link_enable_ipv6(Link *link) {
+         r = sysctl_write_ip_property_boolean(AF_INET6, link->ifname, "disable_ipv6", disabled);
+         if (r < 0)
+                 log_link_warning_errno(link, r, "Cannot %s IPv6 for interface %s: %m",
+-                                       enable_disable(!disabled), link->ifname);
++                                       enable_disable(!disabled),
++                                       (link->ifname) ? link->ifname : "<null>");
+         else
+                 log_link_info(link, "IPv6 successfully %sd", enable_disable(!disabled));
+ 
+-- 
+2.21.0
+
diff --git a/meta/recipes-core/systemd/systemd_242.bb b/meta/recipes-core/systemd/systemd_242.bb
index a6b39d57e8..93c4472bab 100644
--- a/meta/recipes-core/systemd/systemd_242.bb
+++ b/meta/recipes-core/systemd/systemd_242.bb
@@ -22,6 +22,7 @@ SRC_URI += "file://touchscreen.rules \
            file://0003-implment-systemd-sysv-install-for-OE.patch \
            file://0004-rules-whitelist-hd-devices.patch \
            file://0005-rules-watch-metadata-changes-in-ide-devices.patch \
+           file://0006-Fix-format-overflow-warnings-with-gcc-9.patch \
            file://99-default.preset \
            "
 
-- 
2.21.0



More information about the Openembedded-core mailing list