Bug 602941

Summary: RHEL 6 beta 1: syntax error in /etc/sysconfig/network-scripts/ifup-ib
Product: Red Hat Enterprise Linux 6 Reporter: Justin Clift <justin>
Component: rdmaAssignee: Doug Ledford <dledford>
Status: CLOSED DUPLICATE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: low Docs Contact:
Priority: low    
Version: 6.0CC: jclift, knweiss, mpoole, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 596823 Environment:
Last Closed: 2010-08-02 14:21:23 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 Justin Clift 2010-06-11 05:11:02 UTC
+++ This bug was initially created as a clone of Bug #596823 +++

Created an attachment (id=417276)
Syntax error fix for /etc/sysconfig/network-scripts/ifup-ib from openib-1.4.1-5.el5

Description of problem:

There is a syntax error in /etc/sysconfig/network-scripts/ifup-ib which
causes the following boot process error message during Infiniband interface initialization:

ifup-ib: line 79: [: too many arguments

The problem is that bash's "-a" (AND) operator is not evaluated lazily i.e. the following construct in ifup-ib does not work correctly if the MTU variable is unset/empty:

        # cap the MTU where we should based upon mode
        if [ -n "${MTU}" -a $MTU -gt 2044 ]; then
            MTU=2044
        fi

This alternative works because the && operator is evaluated lazily:

        # cap the MTU where we should based upon mode
        if [ -n "${MTU}" ] && [ $MTU -gt 2044 ]; then
            MTU=2044
        fi

Another alternative would be this

        # cap the MTU where we should based upon mode
        if [ -n "${MTU}" ]; then
            if [ $MTU -gt 2044 ]; then
                MTU=2044
            fi
        fi

I've attached a patch which fixes the two occurrences of this construct in ifup-ib.

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

# rpm -q openib
openib-1.4.1-5.el5

How reproducible:

Boot a system with an active IB interface which has not MTU
configured explicitly in /etc/sysconfig/network-scripts/ifcfg-ib0.

Steps to Reproduce:
1. Configure an ib0 interface without setting MTU in /etc/sysconfig/network-scripts/ifcfg-ib0
2. Boot the system
3. Watch for the error messages during ib0 interface initialization.
  
Actual results:

ifup-ib: line 79: [: too many arguments

Expected results:

No error message

Additional info:

Test cases:

$ cat MTU-old.sh
#!/bin/bash                                      

MTU=""
if [ -n "${MTU}" -a $MTU -gt 2044 ]; then
        echo 1a                          
else                                     
        echo 1b                          
fi                                       

MTU="2000"
if [ -n "${MTU}" -a $MTU -gt 2044 ]; then
        echo 2a                          
else                                     
        echo 2b                          
fi

MTU="3000"
if [ -n "${MTU}" -a $MTU -gt 2044 ]; then
        echo 3a
else
        echo 3b
fi

$ cat MTU-new.sh
#!/bin/bash

MTU=""
if [ -n "${MTU}" ] && [ $MTU -gt 2044 ]; then
        echo 1a
else
        echo 1b
fi

MTU="2000"
if [ -n "${MTU}" ] && [ $MTU -gt 2044 ]; then
        echo 2a
else
        echo 2b
fi

MTU="3000"
if [ -n "${MTU}" ] && [ $MTU -gt 2044 ]; then
        echo 3a
else
        echo 3b
fi

Test results:

$ ./MTU-old.sh
./MTU-old.sh: line 4: [: too many arguments
1b
2b
3a
$ ./MTU-new.sh
1b
2b
3a

Comment 2 Justin Clift 2010-06-11 05:13:32 UTC
This bug is present in RHEL 6 beta 1, in the "/etc/sysconfig/network-scripts/ifup-ib" script belonging to the rdma package.

The fix suggested in BZ #596823 fixes the bug in RHEL 6 beta 1 too.

As a data point, this bug is also in the rdma package in F14 rawhide.

Comment 3 RHEL Program Management 2010-06-11 05:23:20 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 RHEL Program Management 2010-07-15 14:51:58 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release. It has
been denied for the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 5 Justin Clift 2010-07-15 14:57:00 UTC
Guys,

This is a trivial scripting fix that addresses an init script problem that should have been caught by QE.

Doug?

Comment 6 Karsten Weiss 2010-07-15 18:17:06 UTC
No offense, but this is absurd. I understand that you want to be on the safe side with the enterprise distribution but come on! IT's a simple two line fix in a bash script. Either include it or drop it. But don't delay the decision for months (like with so many other bugs).

(Do you have an idea how demotivating this is for a bug reporter?)

Comment 7 Karsten Weiss 2010-07-15 18:30:43 UTC
BTW: I've originally filed this on May 27th 2010 (#596823) several *weeks* before RHEL6 beta 2 was released. And even this bug clone for RHEL6 was filed more than two weeks before beta 2.

Not to mention that so far nothing happened for #596823 either.

Comment 8 Doug Ledford 2010-08-02 14:21:23 UTC

*** This bug has been marked as a duplicate of bug 612284 ***