Bug 1309519 - syntax errors in common.sh - check_rpm_to()
syntax errors in common.sh - check_rpm_to()
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: preupgrade-assistant (Show other bugs)
6.8
Unspecified Unspecified
unspecified Severity high
: rc
: ---
Assigned To: pstodulk
Tereza Cerna
: Extras
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-17 21:13 EST by Alois Mahdal
Modified: 2016-05-11 04:26 EDT (History)
7 users (show)

See Also:
Fixed In Version: preupgrade-assistant-2.1.4-10.el6
Doc Type: Bug Fix
Doc Text:
Do not document.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-11 04:26:52 EDT
Type: Bug
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 Alois Mahdal 2016-02-17 21:13:10 EST
Description of problem
======================

Syntax errors are in common.sh:

    /usr/share/preupgrade/common.sh: line 226: syntax error near unexpected token `}'
    /usr/share/preupgrade/common.sh: line 226: `}'
    /usr/share/premigrate/common.sh: line 226: syntax error near unexpected token `}'
    /usr/share/premigrate/common.sh: line 226: `}'

This is apparently caused by two bad `if` calls near the top of the
`check_rpm_to()` function:

    check_rpm_to()
    {
        local RPM=1
        local BINARY=1
        local RPM_NAME=$1
        local BINARY_NAME=$2
        local NOT_APPLICABLE=0

        if [ -z "$1" ] && RPM=0
        if [ -z "$2" ] && BINARY=0


        if [ $RPM -eq 1 ]; then
            RPM_NAME=$(echo "$RPM_NAME" | tr "," " ")
            for pkg in $RPM_NAME
            do
                grep "^$pkg[[:space:]]" $VALUE_RPM_QA > /dev/null
                if [ $? -ne 0 ]; then
                    log_high_risk "Package $pkg is not installed"
                    NOT_APPLICABLE=1
                fi
            done
        fi

        if [ $BINARY -eq 1 ]; then
            BINARY_NAME=$(echo "$BINARY_NAME" | tr "," " ")
            for bin in $BINARY_NAME
            do
                which $bin > /dev/null 2>&1
                if [ $? -ne 0 ]; then
                    log_high_risk "Binary $bin is not installed"
                    NOT_APPLICABLE=1
                fi
            done
        fi


        if [ $NOT_APPLICABLE -eq 1 ]; then
            exit_fail
        fi
    }


Version-Release number of selected component
============================================

preupgrade-assistant-2.1.4-9.el6.noarch


How reproducible
================

Always


Steps to Reproduce
==================

 1. Call

        bash -n /usr/share/preupgrade/common.sh
        bash -n /usr/share/premigrate/common.sh

 2. Check output


Actual results
==============

Syntax error


Expected results
================

No errors


Additional info
===============

At this moment, it's also present in upstream repo (228c64c).
Comment 2 Alois Mahdal 2016-02-17 21:33:50 EST
Reported in upstream, PR added:

https://github.com/phracek/preupgrade-assistant/issues/77
Comment 3 pstodulk 2016-02-18 07:26:05 EST
My mistake. I uses locally updated file instead of the uploaded one. Thanks for quick catch.
Comment 5 Mark Flitter 2016-02-25 06:09:01 EST
setting doc_text-
Comment 6 Tereza Cerna 2016-03-08 03:34:58 EST
-------------------------------------------
Verified in:
    preupgrade-assistant-2.1.5-2.el6.noarch
PASS
-------------------------------------------

# bash -n /usr/share/preupgrade/common.sh 
# echo $?
0
# bash -n /usr/share/premigrate/common.sh 
# echo $?
0

-------------------------------------------
Reproduced in:
    preupgrade-assistant-2.1.4-9.el6.noarch
FAIL
-------------------------------------------

# bash -n /usr/share/preupgrade/common.sh 
/usr/share/preupgrade/common.sh: line 226: syntax error near unexpected token `}'
/usr/share/preupgrade/common.sh: line 226: `}'
# echo $?
2
# bash -n /usr/share/premigrate/common.sh 
/usr/share/premigrate/common.sh: line 226: syntax error near unexpected token `}'
/usr/share/premigrate/common.sh: line 226: `}'
# echo $?
2
Comment 7 errata-xmlrpc 2016-05-11 04:26:52 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-1022.html

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