Bug 1609126

Summary: Fix mem leak and smoke failure for gcc8 in cloudsync
Product: [Community] GlusterFS Reporter: Susant Kumar Palai <spalai>
Component: unclassifiedAssignee: 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: Environment:
Last Closed: 2018-10-23 15:15:49 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:

Description Susant Kumar Palai 2018-07-27 04:56:06 UTC
Description of problem:

From https://build.gluster.org/job/fedora-smoke/6/console

11:14:32 /home/jenkins/root/workspace/fedora-smoke/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c: In function ‘aws_download_s3’:
11:14:32 /home/jenkins/root/workspace/fedora-smoke/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c:480:48: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 1015 [-Werror=format-truncation=]
11:14:32          snprintf(buf, sizeof(buf), "https://%s/%s", priv->hostname, resource);
11:14:32                                                 ^~                   ~~~~~~~~
11:14:32 /home/jenkins/root/workspace/fedora-smoke/xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c:480:9: note: ‘snprintf’ output 10 or more bytes (assuming 4105) into a destination of size 1024
11:14:32          snprintf(buf, sizeof(buf), "https://%s/%s", priv->hostname, resource);
11:14:32          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:14:32 cc1: all warnings being treated as errors
11:14:32 make[10]: *** [Makefile:550: libcloudsyncs3.lo] Error 1


And also sign_req variable in aws_form_request is not freed.

Comment 1 Worker Ant 2018-07-27 05:07:58 UTC
REVIEW: https://review.gluster.org/20564 (cloudsync: fix -Werror=format-truncation error on gcc8) posted (#2) for review on master by Susant Palai

Comment 2 Worker Ant 2018-08-13 14:43:07 UTC
COMMIT: https://review.gluster.org/20564 committed in master by "Amar Tumballi" <amarts> with a commit message- cloudsync: fix -Werror=format-truncation error on gcc8

Here is the gcc8 warning:

libcloudsyncs3.c: In function ‘aws_download_s3’:
libcloudsyncs3.c:480:48: error: ‘%s’ directive output may be
truncated writing up to 4095 bytes into a region of size
1015 [-Werror=format-truncation=]
snprintf(buf, sizeof(buf), "https://%s/%s", priv->hostname, resource);
libcloudsyncs3.c:480:9: note: ‘snprintf’ output 10 or more bytes
(assuming 4105) into a destination of size 1024
snprintf(buf, sizeof(buf), "https://%s/%s", priv->hostname, resource);

Memleak:

It fixes a memleak as well where sign_req in fn: aws_form_request was
not freed. Adjusted the calloc size for sign_req as well to match with
the demand.

Test:

Have tested the local cloudsync regression test to validate the changes.
Smoke validation will be sufficient for the gcc8 warning fixes.

Fixes: bz#1609126
Change-Id: I1c537b30168f2e0b54862344a951843e86b0b488
Signed-off-by: Susant Palai <spalai>

Comment 3 Shyamsundar 2018-10-23 15:15:49 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/