Bug 971783 - rlRun -c deletes /dev/null on RHEL-5
Summary: rlRun -c deletes /dev/null on RHEL-5
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 19
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Petr Muller
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-07 09:23 UTC by Karel Srot
Modified: 2016-09-20 02:10 UTC (History)
6 users (show)

Fixed In Version: beakerlib-1.8-1.fc19
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 971860 (view as bug list)
Environment:
Last Closed: 2013-06-29 18:03:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karel Srot 2013-06-07 09:23:38 UTC
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 09:30:31 UTC
(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 10:59:50 UTC
*** Bug 968381 has been marked as a duplicate of this bug. ***

Comment 3 Petr Muller 2013-06-07 11:39:09 UTC
Moving this to internal product, as I will fix this in RHEL packages only.

Comment 4 Petr Muller 2013-06-07 12:39:57 UTC
Or not.

Comment 5 Petr Muller 2013-06-07 12:51:55 UTC
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 12:53:48 UTC
And this part is clearly not urgent (the --tmpdir part probably is, but that's different story)

Comment 7 Karel Srot 2013-06-07 13:03:39 UTC
(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 13:25:52 UTC
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 12:25:14 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 10 Fedora Update System 2013-06-10 14:39:23 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 11 Fedora Update System 2013-06-29 18:03:54 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.


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