Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1309519

Summary: syntax errors in common.sh - check_rpm_to()
Product: Red Hat Enterprise Linux 6 Reporter: Alois Mahdal <amahdal>
Component: preupgrade-assistantAssignee: Petr Stodulka <pstodulk>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.8CC: fkluknav, mflitter, ovasik, phracek, pstodulk, tcerna, ttomecek
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 08:26:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alois Mahdal 2016-02-18 02:13:10 UTC
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-18 02:33:50 UTC
Reported in upstream, PR added:

https://github.com/phracek/preupgrade-assistant/issues/77

Comment 3 Petr Stodulka 2016-02-18 12:26:05 UTC
My mistake. I uses locally updated file instead of the uploaded one. Thanks for quick catch.

Comment 5 Mark Flitter 2016-02-25 11:09:01 UTC
setting doc_text-

Comment 6 Tereza Cerna 2016-03-08 08:34:58 UTC
-------------------------------------------
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 08:26:52 UTC
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