alba4k / albafetch

Faster neofetch alternative, written in C. Still improving :)
MIT License
66 stars 10 forks source link

[Bug Report] Stuck in the middle #131

Open Dominiquini opened 1 day ago

Dominiquini commented 1 day ago

Describe the bug The application gets stuck in the middle of the output

Expected behavior The app should print and exit

Screenshots albafetch

Desktop (please complete the following information):

Possibly relevant config lines:

Additional context Installed from AUR - albafetch-bin (https://aur.archlinux.org/packages/albafetch-bin)

alba4k commented 1 day ago

Huh

for some reason it gets stuck trying to count the installed packages

would you mind trying to disable pkg_snap pkg_flatpak and pkg_pacman one by one and see which one is causing the issue?

You can check /etc/xdg/albafetch.conf for a reference syntax, not sure if the changes will actually be read if you change any settings from that file, pretty sure that's only on -git (actually, I'm not even sure if I implemented that in git or you still have to copy it to your home dir. Should probably check)

Dominiquini commented 1 day ago

I haven't tested the changes you proposed (I can test them later), but I saw here that the application isn't freezing, it just takes a long time to run (more than 2 minutes!) Maybe this option should be disabled by default!

Thanks.

alba4k commented 1 day ago

It should totally not take that long, especially if it's just pacman. Could you please tell me what you get as installed packages? pip takes a long time to run, which is why I have disabled it by default

debug build, with pip ![immagine](https://github.com/user-attachments/assets/e9e52e56-275a-4bde-a9d1-5884472e995f)
debug build, without pip ![immagine](https://github.com/user-attachments/assets/ce6f955e-7edd-4b21-b202-fcdd76cd3bee)

What is taking two minutes though? it can't be pacman, maybe flatpak or snap?

Dominiquini commented 15 hours ago

What is taking two minutes though? it can't be pacman, maybe flatpak or snap?

I think it's pacman that's taking too long! I'm using EndeavourOS live and I don't have any flatpak or snap installed! I also didn't install anything using pip!

albafetch

If you want, I can test here on my PC how long it takes to extract the number of installed packages... Do you know what command I can run here that simulates what the application uses? Let me know if I can help with anything. If you send me a debug build, I can try running it here and send you the result!

Thanks

alba4k commented 4 hours ago

albafetch basically counts the number of subdirectories inside of /var/lib/pacman/local, basically just like ls /var/lib/pacman/local | wc -l (subtracting 2 because of . and .. being counted too). Weird that such an operation is taking this long (unless your disk is really slow, but I don't think that is the culprit)

You can do that with pacman too using pacman -Qq | wc -l

You can get a debug build by cloning this repository and running make debug inside of it

Dominiquini commented 3 hours ago

I run this commands and both are very fast in my PC:

=> time ls /var/lib/pacman/local | wc -l
3560

real    0m0,011s
user    0m0,006s
sys     0m0,008s_
=> time pacman -Qq | wc -l
3559

real    0m0,028s
user    0m0,018s
sys     0m0,032s_

Later I can test the debug version and share the results!

Thanks

Dominiquini commented 2 hours ago

Debug (--no-pip): albafetch-no-pip

Debug: albafetch