Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1447629

Summary: probe_rpm* errors when applied on non-rpm environment, instead of "not applicable" result
Product: Red Hat Enterprise Linux 7 Reporter: Marek Haicman <mhaicman>
Component: openscapAssignee: Jan Černý <jcerny>
Status: CLOSED ERRATA QA Contact: Marek Haicman <mhaicman>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: mhaicman, mpreisle, openscap-maint, wsato
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 08:45:48 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:
Attachments:
Description Flags
oval to trigger the issue none

Description Marek Haicman 2017-05-03 11:10:38 UTC
Created attachment 1275875 [details]
oval to trigger the issue

Description of problem:
RPM probes now errors when applied on environment where no RPMDB is available. In the past, oval result was "not applicable", now it fails visibly.

Version-Release number of selected component (if applicable):
openscap-1.2.14-1.el7.x86_64

How reproducible:
reliably

Steps to Reproduce:
export OSCAP_PROBE_ROOT="${EMPTY_DIR}"
export OSCAP_PROBE_OS_NAME="Linux"
export OSCAP_PROBE_OS_VERSION="$(uname --kernel-release)" # TODO
export OSCAP_PROBE_ARCHITECTURE="$(uname --hardware-platform)" # TODO
export OSCAP_PROBE_PRIMARY_HOST_NAME="oscap-chroot of $1"

oscap oval eval --id oval:my:def:2 probe_test_rpm.oval.xml


Actual results:
E: probe_rpmverify: RPM: Unable to open /usr/lib/rpm/rpmrc for reading: No such file or directory.

error: Unable to open /usr/lib/rpm/rpmrc for reading: No such file or directory.
W: oscap:     Can't receive message: 125, Operation canceled.
E: oscap:     Recv: retry limit (0) reached.
OpenSCAP Error: Probe at sd=1 (rpmverify) reported an error: Initialization failed [oval_probe_ext.c:393]
Unable to receive a message from probe [oval_probe_ext.c:579]
Invalid oval result type: -1. [oval_resultTest.c:179]

Expected results:
rule results in "not applicable"

Additional info:

Comment 3 Watson Yuuma Sato 2017-05-15 08:53:43 UTC
Fix upstream: https://github.com/OpenSCAP/openscap/pull/733

Comment 6 Marek Haicman 2017-06-12 17:51:18 UTC
Verified fix in version openscap-1.2.14-2.el7.x86_64

OLD(openscap-1.2.14-1.el7.x86_64):
:: [   INFO   ] :: Check behavior of probes after chroot to invalid (empty) directory
:: [   FAIL   ] :: Command 'oscap oval eval --id oval:my:def:2 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.15yWrByZbY' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'cat /tmp/tmp.15yWrByZbY | grep '<object id="oval:ssg:obj:2" version="1" flag="not applicable"/>'' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'oscap oval eval --id oval:my:def:4 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.15yWrByZbY' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'cat /tmp/tmp.15yWrByZbY | grep '<object id="oval:ssg:obj:4" version="1" flag="not applicable"/>'' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'oscap oval eval --id oval:my:def:6 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.15yWrByZbY' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'cat /tmp/tmp.15yWrByZbY | grep '<object id="oval:ssg:obj:6" version="1" flag="not applicable"/>'' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'oscap oval eval --id oval:my:def:8 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.15yWrByZbY' (Expected 0, got 1)
:: [   FAIL   ] :: Command 'cat /tmp/tmp.15yWrByZbY | grep '<object id="oval:ssg:obj:8" version="1" flag="not applicable"/>'' (Expected 0, got 1)

NEW:
:: [   INFO   ] :: Check behavior of probes after chroot to invalid (empty) directory
:: [   PASS   ] :: Command 'oscap oval eval --id oval:my:def:2 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.9wa4EBxEcG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.9wa4EBxEcG | grep '<object id="oval:ssg:obj:2" version="1" flag="not applicable"/>'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'oscap oval eval --id oval:my:def:4 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.9wa4EBxEcG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.9wa4EBxEcG | grep '<object id="oval:ssg:obj:4" version="1" flag="not applicable"/>'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'oscap oval eval --id oval:my:def:6 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.9wa4EBxEcG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.9wa4EBxEcG | grep '<object id="oval:ssg:obj:6" version="1" flag="not applicable"/>'' (Expected 0, got 0)
:: [   PASS   ] :: Command 'oscap oval eval --id oval:my:def:8 --results /dev/stdout probe_test_rpm.oval.xml > /tmp/tmp.9wa4EBxEcG' (Expected 0, got 0)
:: [   PASS   ] :: Command 'cat /tmp/tmp.9wa4EBxEcG | grep '<object id="oval:ssg:obj:8" version="1" flag="not applicable"/>'' (Expected 0, got 0)

Comment 7 errata-xmlrpc 2017-08-01 08:45:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2291