Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#66618 - Unconventional implicit/explicit marking

Attached to Project: Pacman
Opened by Nicholas Serrano (NICHOLAS85) - Tuesday, 12 May 2020, 05:54 GMT
Task Type General Gripe
Category General
Status Unconfirmed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version 5.2.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Summary and Info:
First of all, this is my first 'bug report' so apologies if I'm missing some expected info or etiquette.
pacman -V: "Pacman v5.2.1 - libalpm v12.0.1"

Pacman doesn't seem to align with most other package managers I've used when determining explicit/implicit status for packages. Installing a new package correctly marks it as explicit, however, when you reinstall an implicitly marked package, it retains this status instead of changing to explicit. This is in contrast to apk[2.10.5], apt[2.0.2], dnf[4.2.7], and portage[2.3.89]. [Latest versions I tested]. Testing xbps shows it has the same behavior as Pacman regarding this.

Additionally, the `--asexplicit` flag can be used alongside installing a package to mark it as explicitly installed regardless of its original status. This also marks all newly downloaded dependencies as explicitly installed but does not change the status of any already implicitly installed packages. This seems strange to me. I could understand marking all of the dependencies of a package as explicit but I do not understand skipping marking implicitly installed dependencies as explicit as well. I'd even consider simply just guaranteeing the targeted package will be explicitly installed and not marking its dependencies as explicit.

In summary, I'd reconsider keeping implicit tracking on packages reinstall, to align with most major package managers, and the `--asexplicit` flags behavior when installing new packages.

Steps to Reproduce:
Reinstall an implicitly installed package and view that it retains this status after the transaction.
Install a package, of which you already have some implicit dependencies installed, with the `--asexplicit` flag and view that any new dependencies installed will be marked explicit while previously implicitly installed packages will remain implicit.
This task depends upon

Comment by Allan McRae (Allan) - Tuesday, 12 May 2020, 06:05 GMT
pacman -D
Comment by Nicholas Serrano (NICHOLAS85) - Tuesday, 12 May 2020, 19:57 GMT
Thanks for the suggestion, I am aware of the -D flag and how it can be used here. I was more highlighting the unintuitive behavior exhibited by Pacman by default. I explicitly reinstall an implicitly installed package and I expect it to be marked explicit afterward. If there are reasons to keep the current behavior such as backward compatibility or simply differing philosophy I understand.
Comment by Andrew Gregory (andrewgregory) - Wednesday, 13 May 2020, 04:53 GMT
How do you reinstall/upgrade/downgrade packages without changing the install reason with all those other package managers?
Comment by Eli Schwartz (eschwartz) - Sunday, 24 May 2020, 20:50 GMT
As Andrew pointed out, reinstalling or upgrading/downgrading a currently installed package is a valid use case, and should not involve strange side effects.

Looking at apk add, it seems to have a separate 'apk add --upgrade' option, which seems noisy and pointless, but otherwise it won't actually reinstall the package at all. Perhaps the command serves primarily to ad it to the list of explicitly installed packages, and "also install it if needed"?

portage expects you to rebuild packages from scratch using --oneshot to avoid adding them as explicitly installed (the @world set). Kudos to them for actually having decent documentation on what this does. They're the only ones.

dnf has toplevel commands to install, remove, upgrade, reinstall, and downgrade packages, so presumably if you use those commands the package won't be marked as explicitly installed. On the other hand, I guess you'd you need to figure out which one you're allowed to use? No idea. Documentation is clear as mud.

To add to the list, apt install marks a package as manually installed, but won't reinstall a package. apt reinstall will reinstall it (or take a version spec for upgrading/downgrading I suppose) without changing its install reason.

pacman doesn't have any comparable options to any of this, because we don't have different toplevel commands for installing a package depending on whether it's been previously installed, nor, unlike gentoo, do we consider reinstalling a package only relevant in the sense of rebuilding it with new USE flags. I believe our behavior is sane, and I deplore our lack of competition in the land of sanity, but this is unrelated to how we handle install reasons except incidentally.

> This also marks all newly downloaded dependencies as explicitly installed but does not change the status of any already implicitly installed packages. This seems strange to me.

You're forcing the transaction reason for packages in that transaction, into "asexplicit" mode. Normally, you will do this for packages which are already installed, so no dependencies are added to this transaction list. You don't need to use --asexplicit when newly installing a package, but if you do, and it adds new packages to the transaction list as dependencies, those are grouped together with --asexplicit, because that flag isn't scoped per package. Makes sense?