Incorrect shell script syntax in affine-platform.sh

Bug #1970790 reported by M. Vefa Bicakci
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
New
Low
Unassigned

Bug Description

Brief Description
-----------------
The "affine-platform.sh" script in the starlingx/utilities repository has a few instances of the incorrect use of shell syntax. Here is an example:

        PIDLIST=$( ps -e -p 2 |grep rcuc | awk '{ print $1; }')
        for PID in ${PIDLIST[@]}; do
            chrt -p -f 4 ${PID} 2>/dev/null
        done

PIDLIST is initialized to a scalar/non-array value with =$(...), but the for loop uses it like a shell array with ${PIDLIST[@]}, which is the syntax for iterating over elements in a shell array.

The problematic code can be seen here: https://opendev.org/starlingx/utilities/src/commit/53194825c04f2044e1c4cbd606e9df5f3456f736/utilities/worker-utils/worker-utils/affine-platform.sh#L103

Thankfully, this syntactic issue appears to be harmless, but it is confusing to the reader.

Severity
--------
Minor

Steps to Reproduce
------------------
None. This is a shell script syntax issue.

Expected Behavior
------------------
Proper array iteration syntax should be used, such as the following example:
  https://review.opendev.org/c/starlingx/utilities/+/839795

Actual Behavior
----------------
Incorrect shell script syntax.

Reproducibility
---------------
Not applicable.

System Configuration
--------------------
Not applicable.

Branch/Pull Time/Commit
-----------------------
The issue appears to have been introduced with the following commit from 2019:

commit 66355faf0e771b219524b165326fce4dcea4d185
Date: Thu Jun 27 11:47:12 2019 -0400

    AIO reaffine tasks and k8s-infra during startup

Last Pass
---------
Not applicable.

Timestamp/Logs
--------------
Not applicable.

Test Activity
-------------
Code review.

Workaround
----------
None required.

Tags: stx.config
Ghada Khalil (gkhalil)
tags: added: stx.config
Changed in starlingx:
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.