Macchina-CLI / libmacchina

A library providing access to all sorts of system information.
https://crates.io/crates/libmacchina
MIT License
68 stars 20 forks source link

Fedora not showing the number of RPM packages [BUG] #75

Closed tredeneo closed 3 years ago

tredeneo commented 3 years ago

Describe the bug showing flatpak but not RPM image

To Reproduce $ macchina in the fedora distro with flatpak if I remove flatpak RPM is listed correctly image

Expected behavior display rpm and flatpak like neofetch: image

macchina --doctor output

image

System Information You don't have to provide this information if you're not comfortable doing so, but it'll help us solve the issue a lot faster.

grtcdr commented 3 years ago

Do you have any suggestions?

Maybe we're counting the wrong column in rpmdb.sqlite

grtcdr commented 3 years ago

@laurentlbm Any ideas?

laurentlbm commented 3 years ago

The bug report states that it doesn't show the count when flatpak is installed, not that the count is incorrect.

Maybe it only shows the count for the last package manager it calculated?

tredeneo commented 3 years ago

I'm using the fedora toolbox to create containers and test them and they worked correctly but in the real system the RPM doesn't appear, if I install the snap it appears correctly snap and flatpak but not RPM

I will keep testing trying to find what causes this

grtcdr commented 3 years ago

The bug report states that it doesn't show the count when flatpak is installed, not that the count is incorrect.

Maybe it only shows the count for the last package manager it calculated?

That's not really how it works though. If the count is zero, the package manager is omitted. If not, it appends it to the packages readout.

grtcdr commented 3 years ago

I'm using the fedora toolbox to create containers and test them and they worked correctly but in the real system the RPM doesn't appear, if I install the snap it appears correctly snap and flatpak but not RPM

Looks to me like count_rpm() is the culprit in this case.

laurentlbm commented 3 years ago

I'm using the fedora toolbox to create containers and test them and they worked correctly but in the real system the RPM doesn't appear, if I install the snap it appears correctly snap and flatpak but not RPM

I will keep testing trying to find what causes this

Can you check if the file /var/lib/rpm/rpmdb.sqlite is present? If it is, can you run sqlite3 /var/lib/rpm/rpmdb.sqlite 'select count(*) from Installtid;' and let us know the result?

tredeneo commented 3 years ago

Can you check if the file /var/lib/rpm/rpmdb.sqlite is present?

exist

If it is, can you run sqlite3 /var/lib/rpm/rpmdb.sqlite 'select count(*) from Installtid;' and let us know the result?

image

tredeneo commented 3 years ago

I run the code and not enter in rpm else if(libmacchina) (my debug tools not is working with this code then I've used print) image the flatpak is ok image

in the linux container works image

laurentlbm commented 3 years ago

Maybe the code should check if rpm OR dnf is present.

tredeneo commented 3 years ago

I found, I have the dpkg package on the fedora system (I don't remember why I installed it,there's even in the repositories), it goes into dpkg doesn't get anything and ignores the else if extra::which("rpm")for now having entered an if, the linux containers I tested doesn't have the dpkg package so they worked

I removed the dpkg package and it worked, now I don't know if it's really a problem because it's very specific

laurentlbm commented 3 years ago

Interesting, I also have dpkg installed, but on my Arch machine, and since it checks for pacman first, it didn't cause any problem... Maybe those conditions shouldn't be exclusive, just in case.

grtcdr commented 3 years ago

Even though it's not recommended to have all kinds of package managers installed on your system, I'll still update the code to try each one of them so we can squash this bug.

grtcdr commented 3 years ago

Transfering to libmacchina as that's where the issue is coming from.

grtcdr commented 3 years ago

Fixed with v2.1.8