Bug 1426052 - ‘state’ set but not used error when readline and/or ncurses is not installed
Summary: ‘state’ set but not used error when readline and/or ncurses is not installed
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: cli
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-23 06:27 UTC by Nigel Babu
Modified: 2017-05-30 18:44 UTC (History)
2 users (show)

Fixed In Version: glusterfs-3.11.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-30 18:44:46 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Nigel Babu 2017-02-23 06:27:17 UTC
I was testing smoke on the new machines in the cage when I ran into this

20:03:12 Making install in cli
20:03:12 Making install in src
20:03:12   CC       cli.o
20:03:12   CC       registry.o
20:03:12 /home/jenkins/root/workspace/smoke/cli/src/cli.c: In function ‘_cli_err’:
20:03:12 /home/jenkins/root/workspace/smoke/cli/src/cli.c:520:27: error: variable ‘state’ set but not used [-Werror=unused-but-set-variable]
20:03:12          struct cli_state *state = NULL;
20:03:12                            ^
20:03:12 /home/jenkins/root/workspace/smoke/cli/src/cli.c: In function ‘_cli_out’:
20:03:12 /home/jenkins/root/workspace/smoke/cli/src/cli.c:546:27: error: variable ‘state’ set but not used [-Werror=unused-but-set-variable]
20:03:12          struct cli_state *state = NULL;
20:03:12                            ^
20:03:12 cc1: all warnings being treated as errors

This happened because readline and ncurses weren't installed on the machine.

state was set in line 524:

state = global_state;

But only used if HAVE_READLINE is true. This failure defeats the purpose of putting HAVE_READLINE behind a flag. The code should work in both cases. We will get the right packages on the build machines, but this will be good to fix too.

Comment 1 Worker Ant 2017-02-23 10:37:31 UTC
REVIEW: https://review.gluster.org/16734 (cli: fix error when HAVE_READLINE is false) posted (#2) for review on master by Nigel Babu (nigelb)

Comment 2 Worker Ant 2017-02-23 16:34:07 UTC
REVIEW: https://review.gluster.org/16734 (cli: fix error when HAVE_READLINE is false) posted (#3) for review on master by Nigel Babu (nigelb)

Comment 3 Worker Ant 2017-02-25 12:29:45 UTC
COMMIT: https://review.gluster.org/16734 committed in master by Atin Mukherjee (amukherj) 
------
commit dc15855cea679affd78d28fd94cbea0c108997f0
Author: Nigel Babu <nigelb>
Date:   Thu Feb 23 15:13:43 2017 +0530

    cli: fix error when HAVE_READLINE is false
    
    When HAVE_READLINE is false, Gluster doesn't compile with -Werror flag.
    This will fix it up so it is possible to compile without having readline
    present
    
    Change-Id: Ia6620b5a372318d10f0e908e3d45f4090f99d118
    BUG: 1426052
    Reviewed-on: https://review.gluster.org/16734
    Smoke: Gluster Build System <jenkins.org>
    Tested-by: Nigel Babu <nigelb>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Atin Mukherjee <amukherj>

Comment 4 Shyamsundar 2017-05-30 18:44:46 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-3.11.0, please open a new bug report.

glusterfs-3.11.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] http://lists.gluster.org/pipermail/announce/2017-May/000073.html
[2] https://www.gluster.org/pipermail/gluster-users/


Note You need to log in before you can comment on or make changes to this bug.