The usage of PIPESTATUS picks up wrong value. If not used immediately, the variable gets reset and commands executed within fills up the variable again, which leads to an unintended usage.
Following is a small code explaining the issue -
[suro@oxy-dev ~]$ result=0; echo ${PIPESTATUS[0]}; if [ $result != 0 ]; then echo "Does not execute"; elif [ ${PIPESTATUS[0]} != 0 ]; then echo "Should not come here"; fi
0
Should not come here
[suro@oxy-dev ~]$
The issue is with https:/ /github. com/openstack- dev/devstack/ commit/ 2cb3db338a17bd2 6fef1f56fc155be 5d01a6ef7e
The usage of PIPESTATUS picks up wrong value. If not used immediately, the variable gets reset and commands executed within fills up the variable again, which leads to an unintended usage.
Following is a small code explaining the issue -
[suro@oxy-dev ~]$ result=0; echo ${PIPESTATUS[0]}; if [ $result != 0 ]; then echo "Does not execute"; elif [ ${PIPESTATUS[0]} != 0 ]; then echo "Should not come here"; fi
0
Should not come here
[suro@oxy-dev ~]$
[suro@oxy-dev ~]$ false | false
[suro@oxy-dev ~]$ echo ${PIPESTATUS[1]} ${PIPESTATUS[0]}
1 1
[suro@oxy-dev ~]$ echo ${PIPESTATUS[1]} ${PIPESTATUS[0]}
0
[suro@oxy-dev ~]$