Bug 894053 - rlRun -s fails to detect pipefail on RHEL5
Summary: rlRun -s fails to detect pipefail on RHEL5
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Muller
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 921468 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-10 15:46 UTC by Peter Belanyi
Modified: 2016-09-20 02:09 UTC (History)
8 users (show)

Fixed In Version: beakerlib-1.7-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-22 03:11:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Peter Belanyi 2013-01-10 15:46:02 UTC
Description of problem:

When running a command with rlRun using the -s option (e.g. rlRun -s "$cmd" 0) on RHEL5, it logs a warning message:
:: [ WARNING  ] :: rlRun: `set -o pipefail` not supported, exit code of command will not be checked correctly.
even though pipefail is supported in bash versions greater than 3.

I have checked the rlRun function in /usr/share/beakerlib/testing.sh, it uses grep to check for pipefail support:
  if set -o | grep -q '^pipefail\s'; then
    local pipefail=true
    if set -o | grep -q '^pipefail\s*off$'; then
      set -o pipefail
      local pipefail=false
    fi
  else
    rlLogWarning "rlRun: \`set -o pipefail\` not supported, exit code of command will not be checked correctly."
  fi

I did some manual checks on RHEL 5.8:
[root@dhcp-27-xx tmp]# set -o
allexport       off
...
pipefail        off
...
xtrace          off
[root@dhcp-27-xx tmp]# set -o | grep '^pipefail\s'
[root@dhcp-27-xx tmp]# set -o | grep '^pipefail'
pipefail        off
[root@dhcp-27-xx tmp]# set -o | grep -E '^pipefail\s'
[root@dhcp-27-xx tmp]# set -o | grep -P '^pipefail\s'
pipefail        off
[root@dhcp-27-xx tmp]# set -o | grep '^pipefail[[:space:]]'
pipefail        off
[root@dhcp-27-xx tmp]#

As I see the problem is that \s is not recognized as a special expression for whitespaces in grep patterns on RHEL5. My suggestion would be to use [[:space:]] intstead of \s, it works on both RHEL 5 and 6.


Version-Release number of selected component (if applicable):

Red Hat Enterprise Linux Server release 5.8 (Tikanga)
bash.x86_64 3.2-32.el5
beakerlib-redhat.noarch 1-8.el5
grep.x86_64 2.5.1-55.el5


How reproducible:
100%


Steps to Reproduce:
1. Install beakerlib-redhat on RHEL5
2. run command with rlRun using -s option
  

Actual results:
Warning message is received, can not be sure about test results.


Expected results:
rlRun recognises pipefail support and runs without warnings.

Additional info:

Comment 1 Petr Muller 2013-02-27 14:31:38 UTC
It seems that the [[:space:]] fix you've suggested is indeed a way to go. Thanks.

http://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=ca8f26be2cfc99c26352d7db5032ba13379220cd

Comment 2 Petr Muller 2013-03-14 12:53:33 UTC
*** Bug 921468 has been marked as a duplicate of this bug. ***

Comment 3 Fedora End Of Life 2013-04-03 20:30:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 4 Fedora Update System 2013-04-30 15:10:42 UTC
beakerlib-1.7-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/beakerlib-1.7-1.fc19

Comment 5 Fedora Update System 2013-04-30 20:04:22 UTC
Package beakerlib-1.7-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing beakerlib-1.7-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7067/beakerlib-1.7-1.fc19
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-05-22 03:11:20 UTC
beakerlib-1.7-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.


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