Skip to content

Commit 4b2fa07

Browse files
committed
Packages (Linux): fix dnf package count detection (v2)
1 parent e203f4e commit 4b2fa07

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/detection/packages/packages_linux.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,11 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
554554
if (!(options->disabled & FF_PACKAGES_FLAG_PACMAN_BIT)) packageCounts->pacman += getNumElements(baseDir, "/var/lib/pacman/local", true);
555555
if (!(options->disabled & FF_PACKAGES_FLAG_LPKGBUILD_BIT)) packageCounts->lpkgbuild += getNumElements(baseDir, "/opt/Loc-OS-LPKG/lpkgbuild/remove", false);
556556
if (!(options->disabled & FF_PACKAGES_FLAG_PKGTOOL_BIT)) packageCounts->pkgtool += getNumElements(baseDir, "/var/log/packages", false);
557-
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT)) packageCounts->rpm += getSQLite3Int(baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(*) FROM Name WHERE key != 'gpg-pubkey'", "rpm"); // #1777
557+
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT))
558+
{
559+
// `Sigmd5` is the only table that doesn't contain the virtual `gpg-pubkey` package
560+
packageCounts->rpm += getSQLite3Int(baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(*) FROM Sigmd5", "rpm");
561+
}
558562
if (!(options->disabled & FF_PACKAGES_FLAG_SNAP_BIT)) packageCounts->snap += getSnap(baseDir);
559563
if (!(options->disabled & FF_PACKAGES_FLAG_XBPS_BIT)) packageCounts->xbps += getXBPS(baseDir, "/var/db/xbps");
560564
if (!(options->disabled & FF_PACKAGES_FLAG_BREW_BIT))

0 commit comments

Comments
 (0)