Bug 199976

Summary: "too many arguments" in High-Availability resource IPaddr2
Product: [Fedora] Fedora Reporter: Troy C <troxor>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-25 09:09:50 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:

Description Troy C 2006-07-24 18:25:02 UTC
Description of problem:
IPaddr2 heartbeat resource says "too many arguments" on line 277. 

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

How reproducible:
add the IPaddr2 resource to /etc/ha.d/haresources, start heartbeat

Steps to Reproduce:
1. include IPaddr2::<virtual IP> to /etc/ha.d/haresources
2. /etc/init.d/heartbeat start
3. observe ;)
  
Actual results:
[root@sin ~]# /etc/init.d/heartbeat start
Starting High-Availability services:
/usr/lib/ocf/resource.d/heartbeat/IPaddr2: line 277: [: too many arguments
2006/07/24_13:04:16 INFO: IPaddr2 Resource is stopped
                                                           [  OK  ]
[root@sin ~]#

Expected results:
[root@sin ~]# /etc/init.d/heartbeat start
Starting High-Availability services:
2006/07/24_13:04:16 INFO: IPaddr2 Resource is stopped
                                                           [  OK  ]
[root@sin ~]#

Additional info:

changing line 277 from
        if [ $SYSTYPE = "Linux" -o $SYSTYPE = "SunOS" ]; then
to
         if [ x$SYSTYPE = x"Linux" -o x$SYSTYPE = x"SunOS" ]; then
appears to fix the problem.  Perhaps this is due to $SYSTYPE being assigned an
empty string, which [] doesn't recognize.

Comment 1 Tim Waugh 2006-07-25 09:09:50 UTC
The script you are running needs to be fixed; there is no bash bug here.

Either the fix you propose, or quoting the strings (like '[ "$SYSTYPE" = ...')
will fix the script.