<div dir="ltr">I&#39;m surprised that this is reproducible with gcc7 used in Sumo.<div><br></div><div>Khem suggested to use signed char instead, the pull-request in upstream was updated with signed char as well:</div><div><a href="https://github.com/systemd/systemd/pull/9156">https://github.com/systemd/systemd/pull/9156</a><br></div><div><br></div><div>I&#39;ll send v2.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Jun 2, 2018 at 4:03 AM akuster808 &lt;<a href="mailto:akuster808@gmail.com">akuster808@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 06/01/2018 08:42 AM, Martin Jansa wrote:<br>
&gt; Signed-off-by: Martin Jansa &lt;<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  ...ild-with-gcc8-Werror-format-truncati.patch | 53 +++++++++++++++++++<br>
&gt;  meta/recipes-core/systemd/<a href="http://systemd_237.bb" rel="noreferrer" target="_blank">systemd_237.bb</a>      |  1 +<br>
&gt;  2 files changed, 54 insertions(+)<br>
<br>
I am seeing this same issue in Sumo and I have applied this patch.  Its<br>
currently running a test build.<br>
- armin<br>
&gt;  create mode 100644 meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch<br>
&gt;<br>
&gt; diff --git a/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch b/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch<br>
&gt; new file mode 100644<br>
&gt; index 0000000000..e44f431073<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/systemd/systemd/0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch<br>
&gt; @@ -0,0 +1,53 @@<br>
&gt; +From f9fd4546c25a15629544bc4642a74d7909cc0840 Mon Sep 17 00:00:00 2001<br>
&gt; +From: Martin Jansa &lt;<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>&gt;<br>
&gt; +Date: Fri, 1 Jun 2018 15:22:28 +0000<br>
&gt; +Subject: [PATCH] time-util: fix build with gcc8 -Werror=format-truncation=<br>
&gt; +<br>
&gt; +* it fails with gcc8 when -O1 or -Os is used (and -ftree-vrp which is added by -O2 and higher isn&#39;t used)<br>
&gt; +<br>
&gt; +../git/src/basic/time-util.c: In function &#39;format_timespan&#39;:<br>
&gt; +../git/src/basic/time-util.c:508:46: error: &#39;%0*llu&#39; directive output between 1 and 2147483647 bytes may cause result to exceed &#39;INT_MAX&#39; [-Werror=format-truncation=]<br>
&gt; +                                              &quot;%s&quot;USEC_FMT&quot;.%0*&quot;PRI_USEC&quot;%s&quot;,<br>
&gt; +                                              ^~~~<br>
&gt; +../git/src/basic/time-util.c:508:60: note: format string is defined here<br>
&gt; +                                              &quot;%s&quot;USEC_FMT&quot;.%0*&quot;PRI_USEC&quot;%s&quot;,<br>
&gt; +../git/src/basic/time-util.c:508:46: note: directive argument in the range [0, 18446744073709551614]<br>
&gt; +                                              &quot;%s&quot;USEC_FMT&quot;.%0*&quot;PRI_USEC&quot;%s&quot;,<br>
&gt; +                                              ^~~~<br>
&gt; +../git/src/basic/time-util.c:507:37: note: &#39;snprintf&#39; output 4 or more bytes (assuming 2147483651) into a destination of size 4294967295<br>
&gt; +                                 k = snprintf(p, l,<br>
&gt; +                                     ^~~~~~~~~~~~~~<br>
&gt; +                                              &quot;%s&quot;USEC_FMT&quot;.%0*&quot;PRI_USEC&quot;%s&quot;,<br>
&gt; +                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
&gt; +                                              p &gt; buf ? &quot; &quot; : &quot;&quot;,<br>
&gt; +                                              ~~~~~~~~~~~~~~~~~~~<br>
&gt; +                                              a,<br>
&gt; +                                              ~~<br>
&gt; +                                              j,<br>
&gt; +                                              ~~<br>
&gt; +                                              b,<br>
&gt; +                                              ~~<br>
&gt; +                                              table[i].suffix);<br>
&gt; +                                              ~~~~~~~~~~~~~~~~<br>
&gt; +cc1: some warnings being treated as errors<br>
&gt; +<br>
&gt; +Upstream-Status: Submitted <a href="https://github.com/systemd/systemd/pull/9156" rel="noreferrer" target="_blank">https://github.com/systemd/systemd/pull/9156</a><br>
&gt; +<br>
&gt; +Signed-off-by: Martin Jansa &lt;<a href="mailto:Martin.Jansa@gmail.com" target="_blank">Martin.Jansa@gmail.com</a>&gt;<br>
&gt; +---<br>
&gt; + src/basic/time-util.c | 2 +-<br>
&gt; + 1 file changed, 1 insertion(+), 1 deletion(-)<br>
&gt; +<br>
&gt; +diff --git a/src/basic/time-util.c b/src/basic/time-util.c<br>
&gt; +index 0601d4fa9..db5a9cd78 100644<br>
&gt; +--- a/src/basic/time-util.c<br>
&gt; ++++ b/src/basic/time-util.c<br>
&gt; +@@ -484,7 +484,7 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {<br>
&gt; +                 /* Let&#39;s see if we should shows this in dot notation */<br>
&gt; +                 if (t &lt; USEC_PER_MINUTE &amp;&amp; b &gt; 0) {<br>
&gt; +                         usec_t cc;<br>
&gt; +-                        int j;<br>
&gt; ++                        char j;<br>
&gt; + <br>
&gt; +                         j = 0;<br>
&gt; +                         for (cc = table[i].usec; cc &gt; 1; cc /= 10)<br>
&gt; diff --git a/meta/recipes-core/systemd/<a href="http://systemd_237.bb" rel="noreferrer" target="_blank">systemd_237.bb</a> b/meta/recipes-core/systemd/<a href="http://systemd_237.bb" rel="noreferrer" target="_blank">systemd_237.bb</a><br>
&gt; index 2e6558ded1..0113c2dc72 100644<br>
&gt; --- a/meta/recipes-core/systemd/<a href="http://systemd_237.bb" rel="noreferrer" target="_blank">systemd_237.bb</a><br>
&gt; +++ b/meta/recipes-core/systemd/<a href="http://systemd_237.bb" rel="noreferrer" target="_blank">systemd_237.bb</a><br>
&gt; @@ -54,6 +54,7 @@ SRC_URI += &quot;file://touchscreen.rules \<br>
&gt;             file://libmount.patch \<br>
&gt;             file://0034-Fix-format-truncation-compile-failure-by-typecasting.patch \<br>
&gt;             file://0035-Define-glibc-compatible-basename-for-non-glibc-syste.patch \<br>
&gt; +           file://0036-time-util-fix-build-with-gcc8-Werror-format-truncati.patch \<br>
&gt;             &quot;<br>
&gt;  SRC_URI_append_qemuall = &quot; file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch&quot;<br>
&gt;  <br>
<br>
</blockquote></div>