Bug 968381

Summary: "rlRun -s" design leads to /dev/null removal
Product: [Fedora] Fedora Reporter: Ales Zelinka <azelinka>
Component: beakerlibAssignee: Petr Muller <pmuller>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: bblaskov, ohudlick, pmuller, psklenar, psplicha
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: beakerlib-1.8-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 968300
: 971868 (view as bug list) Environment:
Last Closed: 2013-06-29 18:04:01 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:
Bug Depends On: 968300    
Bug Blocks:    

Description Ales Zelinka 2013-05-29 15:10:05 UTC
+++ This bug was initially created as a clone of Bug #968300 +++

7 RHEL5 TIP runes were killed by one of these tests, please investigate and fix the culprit as soon as possible. 

Switch both tests to a CONFIRMED state in TCMS once they're no longer destructive.


list of test runs affected by this (see test-run notes for IDs of the killed recipes):
TR#64754, TR#64614, TR#64476, TR#64370, TR#64247, TR#64173, TR#64124

--- Additional comment from Robin Hack on 2013-05-29 08:28:14 EDT ---

I think, that is very nasty beakerlib implementation...

From documentation:
-s
    Store stdout and stderr to a file (mixed together, as the user would see it on a terminal) and set $rlRun_LOG variable to name of the file. !!!Caller is responsible for removing the file!!!. When -t option is used, the content of the file becomes tagged too. 

If the -s option is not used, $rlRun_LOG is not modified and keeps its content from the last "rlRun -s". 

From test:
rlRun -s "grep localhost:/usr /etc/mtab" 0 "Grep content of /etc/mtap"

This command has no output!

Test output:
:: [   FAIL   ] :: File '/dev/null' should contain 'noacl' 

From test:
rlRun "rm -r $rlRun_LOG" 0 "Removing $rlRun_LOG"

Test output:
:: [   PASS   ] :: Removing /dev/null

Yeah!!!

--- Additional comment from Robin Hack on 2013-05-29 08:41:00 EDT ---

I wrote little workaround.
But this construction is still very dangerous.

Comment 1 Petr Muller 2013-06-07 10:59:50 UTC

*** This bug has been marked as a duplicate of bug 971783 ***

Comment 2 Petr Muller 2013-06-07 11:57:36 UTC
Sorry, got a bit confused. This is not a dup.

Comment 3 Petr Muller 2013-06-07 13:06:15 UTC
It is not a dup, but it is related. /dev/null should never be propagated to rlLog_LOG: when rlLog_LOG is set, it implies that DO_KEEP was set earlier, and that code should create a temporary logfile.

But the check for logfile creation was missing, /dev/null was used instead and was propagated in rlLog_LOG (in some cases rlRun even deleted it itself :)

I have modified rlRun so that /dev/null is only used in basic mode (no removal or propagation). With switches, when the temporary logfile creation fails, it is reported and switched to basic mode.

https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=13af1c5d7be9c3d40f5b74ea3c3e15419edf9c98

Comment 4 Fedora Update System 2013-06-10 12:25:21 UTC
beakerlib-1.8-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/beakerlib-1.8-1.fc19

Comment 5 Fedora Update System 2013-06-10 14:39:28 UTC
Package beakerlib-1.8-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.8-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-10465/beakerlib-1.8-1.fc19
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-06-29 18:04:01 UTC
beakerlib-1.8-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.