Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 971783 - rlRun -c deletes /dev/null on RHEL-5
rlRun -c deletes /dev/null on RHEL-5
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: beakerlib (Show other bugs)
19
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Petr Muller
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-07 05:23 EDT by Karel Srot
Modified: 2016-09-19 22:10 EDT (History)
6 users (show)

See Also:
Fixed In Version: beakerlib-1.8-1.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 971860 (view as bug list)
Environment:
Last Closed: 2013-06-29 14:03:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Karel Srot 2013-06-07 05:23:38 EDT
Description of problem:

rlRun contain

            -l)
                DO_LOG=true;
                [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP )
                shift;;
            -c)
                DO_LOG=true;
                DO_CON=true;
                LOG_FILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP )
                shift;;
 
which sets DO_LOG=true and fails to set LOG_FILE because on RHEL-5 mktemp doesn't support --tmpdir option.

later on LOG_FILE is set to /dev/null via

[ -n "$LOG_FILE" ] || LOG_FILE="/dev/null"

at the end of the function there is:

    elif $DO_LOG; then
        rm $LOG_FILE
    fi

which removes /dev/null.


Beside fixing the --tmpdir issue I think either of following options would do the job.

  set [ -n "$LOG_FILE" ] || LOG_FILE="/dev/null" && DO_LOG=false
or
    elif $DO_LOG && [ "$LOG_FILE" != /dev/null ]; then
        rm $LOG_FILE


I am using
beakerlib-1.7-1
Comment 1 Karel Srot 2013-06-07 05:30:31 EDT
(In reply to Karel Srot from comment #0)
> Beside fixing the --tmpdir issue 

"tmpdir -p $__INTERNAL_PERSISTENT_TMP" should do the job
Comment 2 Petr Muller 2013-06-07 06:59:50 EDT
*** Bug 968381 has been marked as a duplicate of this bug. ***
Comment 3 Petr Muller 2013-06-07 07:39:09 EDT
Moving this to internal product, as I will fix this in RHEL packages only.
Comment 4 Petr Muller 2013-06-07 08:39:57 EDT
Or not.
Comment 5 Petr Muller 2013-06-07 08:51:55 EDT
Okay: when LOG_FILE fails to be created (and /dev/null is used instead), it's probably a BeakerLib problem. In this case the advanced switches are turned off, and therefore the LOG_FILE is not erased.

https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=13af1c5d7be9c3d40f5b74ea3c3e15419edf9c98
Comment 6 Petr Muller 2013-06-07 08:53:48 EDT
And this part is clearly not urgent (the --tmpdir part probably is, but that's different story)
Comment 7 Karel Srot 2013-06-07 09:03:39 EDT
(In reply to Petr Muller from comment #6)
> And this part is clearly not urgent (the --tmpdir part probably is, but
> that's different story)

If /dev/null is deleted it is recreated as a regular file by any script running >/dev/null. Such a file has wrong selinux context and various services (and therefore also a lot of tests) do not work properly because they cannot access /dev/null (snmpd as an example).
Comment 8 Petr Muller 2013-06-07 09:25:52 EDT
Yep, but /dev/null should be never used for logging in the first place. When the tmp file is created, then /dev/null is not used and therefore not removed.

This remains simply a robustification and better handling of weird error states, but with the wrong mktemp call, we are *causing* weird error state.

But, it's just paper pushing. I'll try to push both fixes in one batch, and will try to do it soon.
Comment 9 Fedora Update System 2013-06-10 08:25:14 EDT
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 10 Fedora Update System 2013-06-10 10:39:23 EDT
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 11 Fedora Update System 2013-06-29 14:03:54 EDT
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.

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