Closed JacksonMcKay closed 4 years ago
Great catch!
This will be interesting to solve.
Good afternoon ! I think I could have a solution for this bug, but since this is my first contribution to an open source project I would appreciate a little help to test some of the package managers that I don't have to be sure that my fix work before making the pull-request :smile:
As you can see from the photo, now my number of "snap" and "dpkg" packages is correct. For now the fix is available only on snap but I think my solution could work also with the other package managers as well with few changes.
Hi! I'd be happy to test your solution with snap
and scoop
- could you make a pull request or push your code somewhere where I can get my hands on it?
Hi! I'd be happy to test your solution with
snap
andscoop
- could you make a pull request or push your code somewhere where I can get my hands on it?
First of all thank you for your kind help ! If you want to get the code you can clone my fork and switch the the branch called packagenum
. I will really appreciate your feedback, especially on scoop since I haven't it on my system and it is the most doubtful change I've made to the code :sweat_smile:
I was able to test my fix on both GNU/Linux (Parrot OS) and Windows 10 [scoop and snap] and it actually worked! I'll submit soon the pull request. If anybody is able to test the script with other package managers that were affected by the bug I would appreciate much. Thank you all ! π
Hi, sorry for the delay!
I was able to test your fix with snap
on Manjaro Linux, scoop
on Windows and port
on a Mac and all returned the correct number of packages both for individual package managers and with the --package_managers off
option (meaning there was no regression there).
Looking at your changes it looks like you've covered all bases and I don't see any reason why there would be issues with the other two package managers mentioned - Nice work!
Thank you so much @JacksonMcKay for your help and feedback, it was fundamental and you were very kind ! I hope this will be merged soon π
similar thing also happens on Bedrock. Neofetch prints the wrong number of portage installed packages (gentoo stratum).
similar thing also happens on Bedrock. Neofetch prints the wrong number of portage installed packages (gentoo stratum).
In theory my fix should address also Bedrock. May I ask you to test my solution on gentoo since I'm not able to do it, please? It would be great. Thank you for your cooperation !
Description
Neofetch claims my system has 9 snap packages instead of 8. I suspect all package managers with extraneous output (headers, etc.) are affected. I had a look at the source, notably: https://github.com/dylanaraps/neofetch/blob/175915d0a6a8183cf00030b6e88412cb13284289/neofetch#L1392 where the packages are counted by
tot
and then((packages-=1))
is done to eliminate the header line. I believe this only decrements the total package count, not the package count for individual package managers which seems to be set inpac()
https://github.com/dylanaraps/neofetch/blob/175915d0a6a8183cf00030b6e88412cb13284289/neofetch#L1311-L1312 with the fragmentmanagers+=("$1 (${manager})")
. It's only after all this that((packages-=1))
comes into play.Apologies, I don't think my bash-fu is up to scratch to fix it myself π
Package managers affected:
tazpkg
,snap
,port
,scoop
,versions
Neofetch version
Neofetch 6.0.0
Screenshot
Notice how
--package_managers off
seems to list one less package than the default optionConfig file
N/A
Verbose log
https://pastebin.com/w5n5JLJg