Bug 654160

Summary: clustat -v reports "clustat version DEVEL" on release package
Product: Red Hat Enterprise Linux 5 Reporter: Ryan Mitchell <rmitchel>
Component: rgmanagerAssignee: Lon Hohberger <lhh>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: low    
Version: 5.5CC: cluster-maint, djansa, edamato, hchiramm
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rgmanager-2.0.52-12.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-21 10:47:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to report version correctly from clustat none

Description Ryan Mitchell 2010-11-17 02:19:11 UTC
Description of problem:
Running "clustat -v" shows that the package is a DEVEL version.  This has concerned customers who are not sure if they are using a development or production package.

Version-Release number of selected component (if applicable):
rgmanager-2.0.52-6.el5_5.8

How reproducible:
Reproduced in-house

Steps to Reproduce:
1. Configure Red Hat Enterprise Linux 5 cluster
2. Run "clustat -v" command.
3. Observe output:
# clustat -v
clustat version DEVEL
  
Actual results:
clustat version DEVEL

Expected results:
clustat version 2.0.52

Additional info:
Version is correctly displayed on RHEL6 clustat.

Comment 1 Ryan Mitchell 2010-11-17 02:22:45 UTC
Seems RELEASE_VERSION is not defined:

src/utils/clustat.c:
1126 #ifdef RELEASE_VERSION
1127         printf("%s version %s\n", basename(argv[0]),
1128                RELEASE_VERSION);
1129 #else
1130         printf("%s version DEVEL\n", basename(argv[0]));
1131 #endif

Not entirely sure where it is supposed to be defined.

Comment 3 Ryan Mitchell 2010-11-25 04:22:37 UTC
=== In Red Hat Customer Portal Case 00381827 ===
--- Comment by Mitchell, Ryan on 11/25/2010 2:22 PM ---

1) The behavior changed on the introduction of rgmanager-2.0.38-2.el5.
- working in rgmanager-2.0.31-1.el5_1.1:
# rpm -q rgmanager
rgmanager-2.0.31-1.el5_1.1
# clustat -v
clustat version 2.0.31

- failing in rgmanager-2.0.38-2.el5
# rpm -q rgmanager
rgmanager-2.0.38-2.el5
# clustat -v
clustat version DEVEL

2) The code in question is:
src/utils/clustat.c:
1125     case VERSION_ONLY:
1126 #ifdef RELEASE_VERSION
1127         printf("%s version %s\n", basename(argv[0]),
1128                RELEASE_VERSION);
1129 #else
1130         printf("%s version DEVEL\n", basename(argv[0]));
1131 #endif

3) I looked at the code for clusvcadm:
src/utils/clusvcadm.c:
318         case 'v':
319             printf("%s\n",PACKAGE_VERSION);
320             return 0;

It returns the PACKAGE_VERSION, rather than RELEASE_VERSION.

4) The makefile defines PACKAGE_VERSION, but there is no mention of RELEASE_VERSION:
src/utils/Makefile:
 21 CFLAGS+= -DPACKAGE_VERSION=\"${RELEASE}\"

5) I created the following patch:
$ cat bz654160-set-release-version.patch
--- a/rgmanager/src/utils/clustat.c 2010-11-25 12:48:28.894761279 +1000
+++ b/rgmanager/src/utils/clustat.c 2010-11-25 12:53:00.074763701 +1000
@@ -1123,9 +1123,9 @@ main(int argc, char **argv)
        ret = !(cman_is_quorate(ch));
        goto cleanup;
    case VERSION_ONLY:
-#ifdef RELEASE_VERSION
+#ifdef PACKAGE_VERSION
        printf("%s version %s\n", basename(argv[0]),
-              RELEASE_VERSION);
+              PACKAGE_VERSION);
 #else
        printf("%s version DEVEL\n", basename(argv[0]));
 #endif

6) After creating a package with this patch, clustat now shows the correct version:
# rpm -q rgmanager
rgmanager-2.0.52-6.8.bz654160
# clustat -v
clustat version 2.0.52

Comment 4 Ryan Mitchell 2010-11-25 04:25:11 UTC
Created attachment 462805 [details]
Patch to report version correctly from clustat

Comment 7 Lon Hohberger 2011-03-29 17:11:38 UTC
Note:

The output of clustat -v isn't a reliable indicator of the output format 
of clustat when run in text mode.

Machine-readable output is available using 'clustat -x', which has been consistent for years.

Comment 11 errata-xmlrpc 2011-07-21 10:47:11 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-1000.html