Bug 1492847

Summary: core (named threads): flood of -Wformat-truncation warnings with gcc-7.
Product: [Community] GlusterFS Reporter: Kaleb KEITHLEY <kkeithle>
Component: coreAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-5.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1492849 1492851 (view as bug list) Environment:
Last Closed: 2018-10-23 15:06:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1492849, 1492851    

Description Kaleb KEITHLEY 2017-09-18 18:07:45 UTC
Description of problem:

Starting in Fedora 26 which has gcc-7.1.x, -Wformat-trunction is enabled
with -Wformat, resulting in a flood of new warnings. This many warnings
is a concern because it makes it hard(er) to see other warnings that
should be addressed.

e.g. see https://kojipkgs.fedoraproject.org//packages/glusterfs/3.12.0/1.fc28/data/logs/x86_64/build.log


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Worker Ant 2017-09-18 18:10:52 UTC
REVIEW: https://review.gluster.org/18287 (core: flood of -Wformat-truncation warnings with gcc-7.1) posted (#2) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 2 Worker Ant 2017-09-18 18:33:50 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#3) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 3 Worker Ant 2017-10-14 11:55:19 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#4) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 4 Worker Ant 2017-10-18 13:58:37 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#5) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 5 Worker Ant 2017-10-20 14:12:03 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#6) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 6 Worker Ant 2017-10-20 15:11:31 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#7) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 7 Worker Ant 2018-07-21 10:18:44 UTC
REVIEW: https://review.gluster.org/18287 (core (named threads): flood of -Wformat-truncation warnings with gcc-7.1) posted (#8) for review on master by Amar Tumballi

Comment 8 Worker Ant 2018-07-23 03:01:40 UTC
COMMIT: https://review.gluster.org/18287 committed in master by "Amar Tumballi" <amarts> with a commit message- core (named threads): flood of -Wformat-truncation warnings with gcc-7.1

Starting in Fedora 26 which has gcc-7.1.x, -Wformat-trunction is enabled
with -Wformat, resulting in a flood of new warnings. This many warnings
is a concern because it makes it hard(er) to see other warnings that
should be addressed.

An example is at
https://kojipkgs.fedoraproject.org//packages/glusterfs/3.12.0/1.fc28/data/logs/x86_64/build.log

For more info see https://review.gluster.org/#/c/18267/

I can't find much (or good) documentation on the heuristics the
compiler uses for this warning. In the case of printing integer types
it appears it looks at the available space in the destination and the
range of values for the variable and/or its type.

To address the specific question about why 0x3ff versus 0xfff to mask
the value, either would suffice to hint to the compiler that the
printed value will fit in three characters. But the loop is from
0...1023 (or 0...0x3ff if you prefer) so I chose that as a more
"accurate" mask to use as it exactly matches the range of values of
the loop.

Fixes: bz#1492847
Change-Id: I6e309ba42159841131d8241bfc0566ef09e00aa9

Comment 9 Shyamsundar 2018-10-23 15:06:00 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.0, please open a new bug report.

glusterfs-5.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2018-October/000115.html
[2] https://www.gluster.org/pipermail/gluster-users/