[oe,meta-networking,3/4] squid: Disable format-truncation warning only with gcc

Message ID 20170825071422.3969-3-raj.khem@gmail.com
State New
Headers show
Series
  • [oe,meta-gnome,1/4] evolution-data-server: Fix build with clang
Related show

Commit Message

Khem Raj Aug. 25, 2017, 7:14 a.m.
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 meta-networking/recipes-daemons/squid/squid_3.5.26.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.14.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Comments

Yi Zhao Aug. 28, 2017, 4:48 a.m. | #1
Hi,

I got an error after applied this patch with latest oe-core:

| ../../../squid-3.5.26/src/format/Format.cc: In member function 'void 
Format::Format::assemble(MemBuf&, const Pointer&, int) const':
| ../../../squid-3.5.26/src/format/Format.cc:345:1: error: '%0*lld' 
directive output may be truncated writing between 1 and 2147483646 bytes 
into a region of size 1024 [-Werror=format-truncation=]
|  Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer 
&al, int logSequenceNumber) const
|  ^~~~~~
| ../../../squid-3.5.26/src/format/Format.cc:345:1: note: directive 
argument in the range [-2147483648, 2147483647]
| ../../../squid-3.5.26/src/format/Format.cc:542:21: note: 'snprintf' 
output between 4 and 4294967295 bytes into a destination of size 1024
|              snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", 
fmt->zero && (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - 
precision - 1 : 0, static_cast<int64_t>(al->cache.start_time.tv_sec), 
precision, (int)(al->cache.start_time.tv_usec / fmt->divisor));
| 
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks,
Yi

在 2017年08月25日 15:14, Khem Raj 写道:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>   meta-networking/recipes-daemons/squid/squid_3.5.26.bb | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
> index 24cd15669..0260497e7 100644
> --- a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
> +++ b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
> @@ -22,10 +22,11 @@ SRC_URI = "http://www.squid-cache.org/Versions/v${MAJ_VER}/${MIN_VER}/${BPN}-${P
>              file://set_sysroot_patch.patch \
>              file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
>              file://0001-SquidNew-use-noexcept-instead-of-throw-for-C-11-comp.patch \
> -           file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
>              file://gcc7-fixes.patch \
>              file://0001-tools.cc-fixed-unused-result-warning.patch \
>              "
> +SRC_URI_append_toolchain-gcc = " file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
> +
>   SRC_URI[md5sum] = "dc1830cd361e077814aa39bcc3691d8b"
>   SRC_URI[sha256sum] = "41d8845863dcd026c856508cd1599d417c8947ffd96e86e24085f9893cb8b8c2"
>
Khem Raj Aug. 28, 2017, 5:39 a.m. | #2
On Sun, Aug 27, 2017 at 9:48 PM, Yi Zhao <yi.zhao@windriver.com> wrote:
> Hi,
>
> I got an error after applied this patch with latest oe-core:
>

yeah, I think its because its bad to use an override which is not in oe-core
but from meta-clang. Drop this patch and try the v2 I just sent.

> | ../../../squid-3.5.26/src/format/Format.cc: In member function 'void
> Format::Format::assemble(MemBuf&, const Pointer&, int) const':
> | ../../../squid-3.5.26/src/format/Format.cc:345:1: error: '%0*lld'
> directive output may be truncated writing between 1 and 2147483646 bytes
> into a region of size 1024 [-Werror=format-truncation=]
> |  Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al,
> int logSequenceNumber) const
> |  ^~~~~~
> | ../../../squid-3.5.26/src/format/Format.cc:345:1: note: directive argument
> in the range [-2147483648, 2147483647]
> | ../../../squid-3.5.26/src/format/Format.cc:542:21: note: 'snprintf' output
> between 4 and 4294967295 bytes into a destination of size 1024
> |              snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero &&
> (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0,
> static_cast<int64_t>(al->cache.start_time.tv_sec), precision,
> (int)(al->cache.start_time.tv_usec / fmt->divisor));
> |
> ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Thanks,
> Yi
>
>
> 在 2017年08月25日 15:14, Khem Raj 写道:
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>   meta-networking/recipes-daemons/squid/squid_3.5.26.bb | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>> b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>> index 24cd15669..0260497e7 100644
>> --- a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>> +++ b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>> @@ -22,10 +22,11 @@ SRC_URI =
>> "http://www.squid-cache.org/Versions/v${MAJ_VER}/${MIN_VER}/${BPN}-${P
>>              file://set_sysroot_patch.patch \
>>              file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
>>
>> file://0001-SquidNew-use-noexcept-instead-of-throw-for-C-11-comp.patch \
>> -
>> file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
>>              file://gcc7-fixes.patch \
>>              file://0001-tools.cc-fixed-unused-result-warning.patch \
>>              "
>> +SRC_URI_append_toolchain-gcc = "
>> file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
>> +
>>   SRC_URI[md5sum] = "dc1830cd361e077814aa39bcc3691d8b"
>>   SRC_URI[sha256sum] =
>> "41d8845863dcd026c856508cd1599d417c8947ffd96e86e24085f9893cb8b8c2"
>>
>
>
Yi Zhao Aug. 28, 2017, 6:04 a.m. | #3
在 2017年08月28日 13:39, Khem Raj 写道:
> On Sun, Aug 27, 2017 at 9:48 PM, Yi Zhao <yi.zhao@windriver.com> wrote:
>> Hi,
>>
>> I got an error after applied this patch with latest oe-core:
>>
> yeah, I think its because its bad to use an override which is not in oe-core
> but from meta-clang. Drop this patch and try the v2 I just sent.

It works well with your V2 patch.

Thanks,
Yi

>
>> | ../../../squid-3.5.26/src/format/Format.cc: In member function 'void
>> Format::Format::assemble(MemBuf&, const Pointer&, int) const':
>> | ../../../squid-3.5.26/src/format/Format.cc:345:1: error: '%0*lld'
>> directive output may be truncated writing between 1 and 2147483646 bytes
>> into a region of size 1024 [-Werror=format-truncation=]
>> |  Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al,
>> int logSequenceNumber) const
>> |  ^~~~~~
>> | ../../../squid-3.5.26/src/format/Format.cc:345:1: note: directive argument
>> in the range [-2147483648, 2147483647]
>> | ../../../squid-3.5.26/src/format/Format.cc:542:21: note: 'snprintf' output
>> between 4 and 4294967295 bytes into a destination of size 1024
>> |              snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero &&
>> (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0,
>> static_cast<int64_t>(al->cache.start_time.tv_sec), precision,
>> (int)(al->cache.start_time.tv_usec / fmt->divisor));
>> |
>> ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Thanks,
>> Yi
>>
>>
>> 在 2017年08月25日 15:14, Khem Raj 写道:
>>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>> ---
>>>    meta-networking/recipes-daemons/squid/squid_3.5.26.bb | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>>> b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>>> index 24cd15669..0260497e7 100644
>>> --- a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>>> +++ b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
>>> @@ -22,10 +22,11 @@ SRC_URI =
>>> "http://www.squid-cache.org/Versions/v${MAJ_VER}/${MIN_VER}/${BPN}-${P
>>>               file://set_sysroot_patch.patch \
>>>               file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
>>>
>>> file://0001-SquidNew-use-noexcept-instead-of-throw-for-C-11-comp.patch \
>>> -
>>> file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
>>>               file://gcc7-fixes.patch \
>>>               file://0001-tools.cc-fixed-unused-result-warning.patch \
>>>               "
>>> +SRC_URI_append_toolchain-gcc = "
>>> file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
>>> +
>>>    SRC_URI[md5sum] = "dc1830cd361e077814aa39bcc3691d8b"
>>>    SRC_URI[sha256sum] =
>>> "41d8845863dcd026c856508cd1599d417c8947ffd96e86e24085f9893cb8b8c2"
>>>
>>

Patch

diff --git a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
index 24cd15669..0260497e7 100644
--- a/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
+++ b/meta-networking/recipes-daemons/squid/squid_3.5.26.bb
@@ -22,10 +22,11 @@  SRC_URI = "http://www.squid-cache.org/Versions/v${MAJ_VER}/${MIN_VER}/${BPN}-${P
            file://set_sysroot_patch.patch \
            file://squid-don-t-do-squid-conf-tests-at-build-time.patch \
            file://0001-SquidNew-use-noexcept-instead-of-throw-for-C-11-comp.patch \
-           file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch \
            file://gcc7-fixes.patch \
            file://0001-tools.cc-fixed-unused-result-warning.patch \
            "
+SRC_URI_append_toolchain-gcc = " file://0001-configure-Check-for-Wno-error-format-truncation-comp.patch"
+
 SRC_URI[md5sum] = "dc1830cd361e077814aa39bcc3691d8b"
 SRC_URI[sha256sum] = "41d8845863dcd026c856508cd1599d417c8947ffd96e86e24085f9893cb8b8c2"