-
Notifications
You must be signed in to change notification settings - Fork 397
Always use /var/lib/rpm as rpm dbpath #1956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This issue was initially identified and attempted to be fixed in b0d013a by @matusmarhefka |
Thanks for the PR! It looks great, but unfortunately, the tests are failing. I'm trying to investigate the fails and I will let you know once I will have any results. |
@candrews I have found it. You need to put the same |
Phenomenal! I've updated this MR with that change; I'm eagerly awaiting the "all tests pass" result 👍 |
@jan-cerny everything looks good now - shall this be merged? 🤞 |
@candrews Thank you! We are almost there! The last failing CI job is the Ubuntu job where unfortunately we use some RPM related content for testing the generic data stream processing and the changes in this PR uncovered this. Ideally, we should make the failing tests distribution-agnostic. For this moment we can simply skip these tests on systems where RPM isn't installed. I was able to skip them and make it green on Ubuntu by this change: diff --git a/tests/DS/test_ds_misc.sh b/tests/DS/test_ds_misc.sh
index 4d3b1ec55..8f2b6cb96 100755
--- a/tests/DS/test_ds_misc.sh
+++ b/tests/DS/test_ds_misc.sh
@@ -77,6 +77,7 @@ sds_add_multiple_twice(){
function test_eval {
probecheck "rpminfo" || return 255
+ [ -e "/var/lib/rpm" ] || return 255
local stderr=$(mktemp -t ${name}.out.XXXXXX)
$OSCAP xccdf eval "${srcdir}/$1" 2> $stderr
diff /dev/null $stderr; rm $stderr
diff --git a/tests/DS/test_sds_eval.sh b/tests/DS/test_sds_eval.sh
index fc9da3cc5..606bb9150 100755
--- a/tests/DS/test_sds_eval.sh
+++ b/tests/DS/test_sds_eval.sh
@@ -12,6 +12,7 @@ set -e -o pipefail
function test_eval {
probecheck "rpminfo" || return 255
+ [ -e "/var/lib/rpm" ] || return 255
local stderr=$(mktemp -t ${name}.out.XXXXXX)
$OSCAP xccdf eval "${srcdir}/$1" 2> $stderr
diff /dev/null $stderr; rm $stderr But I haven't tried if it works on CI. |
Ideally, we should make the failing tests distribution-agnostic. For this moment we can simply skip these tests on systems where RPM isn't installed. Signed-off-by: Craig Andrews <candrews@integralblue.com>
Fedora >=36 changed the default dbpath in librpm from /var/lib/rpm to /usr/lib/sysimage/rpm Therefore, when running openscap on a Fedora >=36 system scanning another systems (such as RHEL, SLES, Fedora<36) openscap's librpm will try to read the rpm db from /usr/lib/sysimage/rpm which doesn't exist and therefore won't work. In implementing this change, /var/lib/rpm is still a symlink to /usr/lib/sysimage/rpm so /var/lib/rpm still works. So /var/lib/rpm is a dbpath that will work on all systems. Therefore, set the dbpath to be /var/lib/rpm, allow openscap running on any system to scan any system. See: https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr Fixes: OpenSCAP#1942
I added the change this PR, we'll soon find out! |
All checks have passed 🥳 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 🍰
Fedora >=36 changed the default dbpath in librpm from /var/lib/rpm to /usr/lib/sysimage/rpm Therefore, when running openscap on a Fedora >=36 system scanning another systems (such as RHEL, SLES, Fedora<36) openscap's librpm will try to read the rpm db from /usr/lib/sysimage/rpm which doesn't exist and therefore won't work. In implementing this change, /var/lib/rpm is still a symlink to /usr/lib/sysimage/rpm so /var/lib/rpm still works. So /var/lib/rpm is a dbpath that will work on all systems. Therefore, set the dbpath to be /var/lib/rpm, allow openscap running on any system to scan any system.
See: https://fedoraproject.org/wiki/Changes/RelocateRPMToUsr
Fixes: #1942
cd build && cmake ../ && make -j4 && ctest
shows all tests as passing on my Fedora 37 system.