Bug 602941 - RHEL 6 beta 1: syntax error in /etc/sysconfig/network-scripts/ifup-ib
RHEL 6 beta 1: syntax error in /etc/sysconfig/network-scripts/ifup-ib
Status: CLOSED DUPLICATE of bug 612284
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rdma (Show other bugs)
6.0
All Linux
low Severity low
: rc
: ---
Assigned To: Doug Ledford
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-11 01:11 EDT by Justin Clift
Modified: 2010-08-02 10:21 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 596823
Environment:
Last Closed: 2010-08-02 10:21:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Justin Clift 2010-06-11 01:11:02 EDT
+++ 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 01:13:32 EDT
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 Product and Program Management 2010-06-11 01:23:20 EDT
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 Product and Program Management 2010-07-15 10:51:58 EDT
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 10:57:00 EDT
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 14:17:06 EDT
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 14:30:43 EDT
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 10:21:23 EDT

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

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