Skip to content
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

Search /usr/share for rpmdb to fix scan on ostree-managed images #1756

Merged
merged 1 commit into from
May 2, 2023

Conversation

fpytloun
Copy link
Contributor

fixes: #1755

@@ -11,7 +11,7 @@ import (
// Packages is the legacy Berkely db based format
// Packages.db is the "ndb" format used in SUSE
// rpmdb.sqlite is the sqlite format used in fedora + derivates
const RpmDBGlob = "**/var/lib/rpm/{Packages,Packages.db,rpmdb.sqlite}"
const RpmDBGlob = "**/{var/lib,usr/share}/rpm/{Packages,Packages.db,rpmdb.sqlite}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to add a test that has a simple rpmdb in this alternate location?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: if you'd like to also support OpenSUSE, you might also need /var/lib/sysimage/ like in snyk/snyk-docker-plugin@27958de#diff-eee7d1bac79f2c7987a266d8feb00c77789bdbe75c4149b727af365f22e84f0aR14

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already support opensuse today because there is a symlink in var/lib/rpm back to usr/lib/sysimage. However, I'm not certain which distribution is using /var/lib/sysimage off the top of my head (sounds familiar though).

❯ docker run --rm -it opensuse/tumbleweed ls -al /var/lib/sysimage
ls: cannot access '/var/lib/sysimage': No such file or directory

❯ docker run --rm -it opensuse/tumbleweed ls -al /var/lib/rpm
lrwxrwxrwx 1 root root 26 Apr 26 18:26 /var/lib/rpm -> ../../usr/lib/sysimage/rpm

❯ docker run --rm -it opensuse/tumbleweed ls -al /usr/lib/sysimage/rpm
total 10292
drwxr-xr-x 2 root root    4096 Apr 26 18:26 .
drwxr-xr-x 3 root root    4096 Apr 26 18:26 ..
-rw-r--r-- 1 root root       0 Apr 26 18:26 .rpm.lock
-rw-r--r-- 1 root root 6377472 Apr 26 18:26 Index.db
-rw-r--r-- 1 root root 4151824 Apr 26 18:26 Packages.db

@kzantow
Copy link
Contributor

kzantow commented Apr 21, 2023

@fpytloun you'll also need to sign-off your commits

@wagoodman
Copy link
Contributor

I added a cataloger glob test to make certain the cataloger is selecting the right paths, so the PR should be good to go once you sign off your commit @fpytloun . 👍

@fpytloun
Copy link
Contributor Author

fpytloun commented May 1, 2023

Thank you @wagoodman 👍

Signed commit, should be ready now 🙂

@fpytloun fpytloun force-pushed the ostree branch 2 times, most recently from d012417 to a168f9e Compare May 2, 2023 10:00
Fixes: anchore#1755
Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
Signed-off-by: Filip Pytloun <filip@pytloun.cz>
@fpytloun
Copy link
Contributor Author

fpytloun commented May 2, 2023

Sorry, to fix DCO I had to rebase and squash your commit into mine with co-authored-by, @wagoodman

Copy link
Contributor

@wagoodman wagoodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @fpytloun 🙌

@wagoodman wagoodman merged commit 95a04ca into anchore:main May 2, 2023
9 checks passed
spiffcs added a commit that referenced this pull request May 4, 2023
* main:
  chore(docs): Update lists of catalogers (#1780)
  chore: add more detail on SPDX file IDs (#1769)
  Search /usr/share for rpmdb to fix scan on ostree-managed images (#1756)
  chore(deps): bump github.com/docker/docker (#1767)
  rename sbom.PackageCatalog to sbom.Packages (#1773)
  chore(deps): bump modernc.org/sqlite from 1.22.0 to 1.22.1 (#1768)

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
…hore#1756)

Fixes: anchore#1755

Signed-off-by: Filip Pytloun <filip@pytloun.cz>
Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPM database not found on ostree-managed systems
4 participants