systemd: fix build with gcc8
PATCH 1/1 systemd: fix build with gcc8
--- ...ild-with-gcc8-Werror-format-truncati.patch | 53 +++++++++++++++++++ meta/recipes-core/systemd/systemd_237.bb | 1 + 2 files changed, 54 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +53 -0
@@ -0,0 +1,53 @@ +From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001 +From: Martin Jansa <[email protected]> +Date: Fri, 1 Jun 2018 15:22:28 +0000 +Subject: [PATCH] time-util: fix build with gcc8 -Werror=format-truncation= + +* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used) + +../git/src/basic/time-util.c: In function 'format_timespan': +../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:508:60: note: format string is defined here + "%s"USEC_FMT".%0*"PRI_USEC"%s", +../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295 + k = snprintf(p, l, + ^~~~~~~~~~~~~~ + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + p > buf ? " " : "", + ~~~~~~~~~~~~~~~~~~~ + a, + ~~ + j, + ~~ + b, + ~~ + table[i].suffix); + ~~~~~~~~~~~~~~~~ +cc1: some warnings being treated as errors + +Upstream-Status: Submitted https://github.com/systemd/systemd/pull/9156 + +Signed-off-by: Martin Jansa <[email protected]> +--- + src/basic/time-util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 0601d4fa9..db5a9cd78 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { + /* Let's see if we should shows this in dot notation */ + if (t < USEC_PER_MINUTE && b > 0) { + usec_t cc; +- int j; ++ char j; + + j = 0; + for (cc = table[i].usec; cc > 1; cc /= 10)
meta/recipes-core/systemd/systemd_237.bb +1 -0
@@ -54,6 +54,7 @@ SRC_URI += "file://touchscreen.rules \ file://libmount.patch \ file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \ file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \ " SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
Signature · 1 line
2.17.0
Quoted 5 lines · Martin Jansa
Signed-off-by Martin Jansa <[email protected]>--- ...ild-with-gcc8-Werror-format-truncati.patch | 53 +++++++++++++++++++ meta/recipes-core/systemd/systemd_237.bb | 1 + 2 files changed, 54 insertions(+)
I am seeing this same issue in Sumo and I have applied this patch. Its currently running a test build.
- armin
Quoted 73 lines
create mode 100644 meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patchmeta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +53
-0@@ -0,0 +1,53 @@ +From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001 +From: Martin Jansa <[email protected]> +Date: Fri, 1 Jun 2018 15:22:28 +0000 +Subject: [PATCH] time-util: fix build with gcc8 -Werror=format-truncation= + +* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used) + +../git/src/basic/time-util.c: In function 'format_timespan': +../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:508:60: note: format string is defined here + "%s"USEC_FMT".%0*"PRI_USEC"%s", +../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295 + k = snprintf(p, l, + ^~~~~~~~~~~~~~ + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + p > buf ? " " : "", + ~~~~~~~~~~~~~~~~~~~ + a, + ~~ + j, + ~~ + b, + ~~ + table[i].suffix); + ~~~~~~~~~~~~~~~~ +cc1: some warnings being treated as errors + +Upstream-Status: Submitted https://github.com/systemd/systemd/pull/9156 + +Signed-off-by: Martin Jansa <[email protected]> +--- + src/basic/time-util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 0601d4fa9..db5a9cd78 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { + /* Let's see if we should shows this in dot notation */ + if (t < USEC_PER_MINUTE && b > 0) { + usec_t cc; +- int j; ++ char j; + + j = 0; + for (cc = table[i].usec; cc > 1; cc /= 10)meta/recipes-core/systemd/systemd_237.bb +1
-0@@ -54,6 +54,7 @@ SRC_URI += "file://touchscreen.rules \ file://libmount.patch \ file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \ file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \ " SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
I'm surprised that this is reproducible with gcc7 used in Sumo.
Khem suggested to use signed char instead, the pull-request in upstream was updated with signed char as well:
https://github.com/systemd/systemd/pull/9156
I'll send v2.
Quoted 108 lines · On Sat, Jun 2, 2018 at 4:03 AM akuster808 <[email protected]> wrote:
Quoted 5 lines · Martin Jansa
Signed-off-by Martin Jansa <[email protected]>--- ...ild-with-gcc8-Werror-format-truncati.patch | 53 +++++++++++++++++++ meta/recipes-core/systemd/systemd_237.bb | 1 + 2 files changed, 54 insertions(+)I am seeing this same issue in Sumo and I have applied this patch. Its currently running a test build.
- arminQuoted 1 line
create mode 100644
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patchQuoted 2 lines
diff --git
a/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patchb/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patchQuoted 4 lines
new file mode 100644
index 0000000000..e44f431073
---/dev/null
+++
b/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patchmeta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch line 4
Quoted 5 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +4
-0@@ -0,0 +1,53 @@ +From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001 +From: Martin Jansa <[email protected]> +Date: Fri, 1 Jun 2018 15:22:28 +0000 +Subject: [PATCH] time-util: fix build with gcc8-Werror=format-truncation=
Review line 6
Quoted 2 lines
(quoted diff) +2
-0+ +* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which isadded by -O2 and higher isn't used)
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch
Quoted 3 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +3
-0+ +../git/src/basic/time-util.c: In function 'format_timespan': +../git/src/basic/time-util.c:508:46: error: '%0*llu' directive outputbetween 1 and 2147483647 bytes may cause result to exceed '
INT_MAX' [-Werror=format-truncation=]Review line 10
Quoted 1 line
(quoted diff) +1
-0+"%s"USEC_FMT".%0*"PRI_USEC"%s",
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch line 33
Quoted 3 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +3
-0+ ^~~~ +../git/src/basic/time-util.c:508:60: note: format string is defined here +"%s"USEC_FMT".%0*"PRI_USEC"%s",
Review line 14
Quoted 1 line
(quoted diff) +1
-0+../git/src/basic/time-util.c:508:46: note: directive argument in therange [0, 18446744073709551614]
Review line 15
Quoted 1 line
(quoted diff) +1
-0+"%s"USEC_FMT".%0*"PRI_USEC"%s",
Review line 17
Quoted 2 lines
(quoted diff) +2
-0+ ^~~~ +../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or morebytes (assuming 2147483651) into a destination of size 4294967295
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch line 33
Quoted 3 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +3
-0+ k = snprintf(p, l, + ^~~~~~~~~~~~~~ +"%s"USEC_FMT".%0*"PRI_USEC"%s",
Review line 21
Quoted 1 line
(quoted diff) +1
-0+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 14 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +14
-0+ p > buf ? " " : "", + ~~~~~~~~~~~~~~~~~~~ + a, + ~~ + j, + ~~ + b, + ~~ + table[i].suffix); + ~~~~~~~~~~~~~~~~ +cc1: some warnings being treated as errors + +Upstream-Status: Submitted https://github.com/systemd/systemd/pull/9156 +meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch
Quoted 10 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +10
-0+Signed-off-by: Martin Jansa <[email protected]> +--- + src/basic/time-util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 0601d4fa9..db5a9cd78 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_tt,
usec_taccuracy) {Review
Quoted 9 lines
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +8
-0+ /* Let's see if we should shows this in dot notation */ + if (t < USEC_PER_MINUTE && b > 0) { + usec_t cc; +- int j; ++ char j; + + j = 0; + for (cc = table[i].usec; cc > 1; cc /= 10)(quoted diff) +0
-0b/meta/recipes-core/systemd/systemd_237.bb
meta/recipes-core/systemd/systemd_237.bb SRC_URI += "file://touchscreen.rules \ · line 55
Quoted 6 lines
index
2e6558ded1..0113c2dc72100644meta/recipes-core/systemd/systemd_237.bb +0
-0@@ -54,6 +54,7 @@ SRC_URI += "file://touchscreen.rules \ file://libmount.patch \file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \
Quoted 1 line
file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
Quoted 1 line
+
file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \
Quoted 2 lines
"
SRC_URI_append_qemuall= "file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
Quoted 1 line
PATCH v2 1/1 systemd: fix build with gcc8
In reply to Martin Jansa--- ...ild-with-gcc8-Werror-format-truncati.patch | 53 +++++++++++++++++++ meta/recipes-core/systemd/systemd_237.bb | 1 + 2 files changed, 54 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch
meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch new file +53 -0
@@ -0,0 +1,53 @@ +From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001 +From: Martin Jansa <[email protected]> +Date: Fri, 1 Jun 2018 15:22:28 +0000 +Subject: [PATCH] time-util: fix build with gcc8 -Werror=format-truncation= + +* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn't used) + +../git/src/basic/time-util.c: In function 'format_timespan': +../git/src/basic/time-util.c:508:46: error: '%0*llu' directive output between 1 and 2147483647 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:508:60: note: format string is defined here + "%s"USEC_FMT".%0*"PRI_USEC"%s", +../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614] + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ^~~~ +../git/src/basic/time-util.c:507:37: note: 'snprintf' output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295 + k = snprintf(p, l, + ^~~~~~~~~~~~~~ + "%s"USEC_FMT".%0*"PRI_USEC"%s", + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + p > buf ? " " : "", + ~~~~~~~~~~~~~~~~~~~ + a, + ~~ + j, + ~~ + b, + ~~ + table[i].suffix); + ~~~~~~~~~~~~~~~~ +cc1: some warnings being treated as errors + +Upstream-Status: Submitted https://github.com/systemd/systemd/pull/9156 + +Signed-off-by: Martin Jansa <[email protected]> +--- + src/basic/time-util.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 0601d4fa9..db5a9cd78 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { + /* Let's see if we should shows this in dot notation */ + if (t < USEC_PER_MINUTE && b > 0) { + usec_t cc; +- int j; ++ signed char j; + + j = 0; + for (cc = table[i].usec; cc > 1; cc /= 10)
meta/recipes-core/systemd/systemd_237.bb +1 -0
@@ -54,6 +54,7 @@ SRC_URI += "file://touchscreen.rules \ file://libmount.patch \ file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \ file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \ " SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
Signature · 1 line
2.17.0