Description of problem: When running a test which uses $LOG_FILE variable, if rlRun is used to call a Bash function, $LOG_FILE variable is deleted/not available inside this function. See the reproducer script. Version-Release number of selected component (if applicable): beakerlib-1.10-2.el7eso beakerlib-1.11-1.el7 How reproducible: Always Steps to Reproduce: Use following test script to reproduce the problem: ================================= . /usr/bin/rhts-environment.sh echo "rhts-env sourced, status = $?" . /usr/lib/beakerlib/beakerlib.sh echo "beakerlib sourced, status = $?" set -o pipefail echo "set -o pipefail, status = $?" function some_func() { echo "Doing echo \$LOG_FILE" echo $LOG_FILE echo "Doing echo \$SOME_VAR" echo $SOME_VAR } rlJournalStart rlPhaseStartTest SOME_VAR="Some var string" LOG_FILE="Test string" echo "Running 'echo \$LOG_FILE' and 'echo \$SOME_VAR' outside the some_func()" echo $LOG_FILE echo $SOME_VAR echo "Running some_func() with rlRun" rlRun "some_func" echo "Running some_func() without rlRun" some_func rlPhaseEnd rlJournalEnd rlJournalPrintText ================================= Actual results: Running provided script with beakerlib-1.10-2.el7eso gives following output (only relevant lines pasted): <...> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Running 'echo $LOG_FILE' and 'echo $SOME_VAR' outside the some_func() Test string Some var string Running some_func() with rlRun :: [ BEGIN ] :: Running 'some_func' Doing echo $LOG_FILE /dev/null Doing echo $SOME_VAR Some var string :: [ PASS ] :: Command 'some_func' (Expected 0, got 0) Running some_func() without rlRun Doing echo $LOG_FILE Test string Doing echo $SOME_VAR Some var string :: [ 08:50:08 ] :: JOURNAL XML: /var/tmp/beakerlib-TB2WcSz/journal.xml :: [ 08:50:08 ] :: JOURNAL TXT: /var/tmp/beakerlib-TB2WcSz/journal.txt :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: TEST PROTOCOL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Package : unknown :: [ LOG ] :: beakerlib RPM : beakerlib-1.10-2.el7eso :: [ LOG ] :: bl-redhat RPM : beakerlib-redhat-1-18.el7eso :: [ LOG ] :: Test started : 2015-11-26 08:50:08 EST :: [ LOG ] :: Test finished : 2015-11-26 08:50:08 EST :: [ LOG ] :: Test name : unknown :: [ LOG ] :: Distro: : Red Hat Enterprise Linux Server release 7.2 (Maipo) :: [ LOG ] :: Hostname : hp-dl360egen8-01.rhts.eng.bos.redhat.com :: [ LOG ] :: Architecture : x86_64 <...> Running provided script with beakerlib-1.10-2.el7eso gives following output (only relevant lines pasted): <...> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Test :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Running 'echo $LOG_FILE' and 'echo $SOME_VAR' outside the some_func() Test string Some var string Running some_func() with rlRun :: [ BEGIN ] :: Running 'some_func' Doing echo $LOG_FILE Doing echo $SOME_VAR Some var string :: [ PASS ] :: Command 'some_func' (Expected 0, got 0) Running some_func() without rlRun Doing echo $LOG_FILE Test string Doing echo $SOME_VAR Some var string :: [ 08:54:01 ] :: JOURNAL XML: /var/tmp/beakerlib-uOqtv8b/journal.xml :: [ 08:54:01 ] :: JOURNAL TXT: /var/tmp/beakerlib-uOqtv8b/journal.txt :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: TEST PROTOCOL :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Package : unknown :: [ LOG ] :: beakerlib RPM : beakerlib-1.11-1.el7 :: [ LOG ] :: bl-redhat RPM : beakerlib-redhat-1-18.el7eso :: [ LOG ] :: Test started : 2015-11-26 08:54:01 EST :: [ LOG ] :: Test finished : 2015-11-26 08:54:01 EST :: [ LOG ] :: Test name : unknown :: [ LOG ] :: Distro: : Red Hat Enterprise Linux Server release 7.2 (Maipo) :: [ LOG ] :: Hostname : hp-dl360egen8-01.rhts.eng.bos.redhat.com :: [ LOG ] :: Architecture : x86_64 <...> Expected results: Script should keep content of $LOG_FILE variable in Bash function called by rlRun.
We have recently changed all the function variables to local ones but in this particular case the variables still collide with user's code. I will prefix all the internal variables a put it into the documentation do future. Until that please workaround this by using another variable name, e.g. 'LOG_FILE2' or 'log_file'.
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle. Changing version to '24'. More information and reason for this action is here: https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
fixed by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=0fd534efe67d71d5e55bac15c48cf4e8d4a3f4fe
Thank you Dalibor!
yet another commit with documentation improvement https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=8cf7fb638e3f32325b8349941b18dc5e36e78923