FS#10823 - Marking package as explicitely installed doesn't work

Attached to Project: Pacman
Opened by Daniel D. (danieldanner) - Friday, 04 July 2008, 13:59 GMT
Last edited by Dan McGee (toofishes) - Saturday, 05 July 2008, 23:05 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To No-one
Architecture i686
Severity Medium
Priority Normal
Reported Version 3.1.4
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:
"pacman -Qtd" showed some packages I wanted to keep as explicitely installed so I did "pacman -S <pkgs>" for these.

Afterwards, "pacman -Qi <pkg>" still claimed the packages to be "Installed as a dependency for another package".



Steps to Reproduce:
1. pacman -Qtd (about 20 packages show up)
2. (choose pkgconfig, for example)
3. pacman -Qi pkgconfig | grep "Install Reason"
->Install Reason : Installed as a dependency for another package
4. pacman -S pkgconfig
5. pacman -Qi pkgconfig | grep "Install Reason"
->Install Reason : Installed as a dependency for another package



Also see this log:
root@jukebox ~ # pacman -Qi pkgconfig | grep "Install Reason"
Install Reason : Installed as a dependency for another package
root@jukebox ~ # pacman -S pkgconfig
warning: pkgconfig-0.23-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets: pkgconfig-0.23-1

Total Download Size: 0.00 MB
Total Installed Size: 0.10 MB

Proceed with installation? [Y/n]
checking package integrity...
(1/1) checking for file conflicts [###########################################################################################] 100%
(1/1) upgrading pkgconfig [###########################################################################################] 100%
root@jukebox ~ # pacman -Qi pkgconfig | grep "Install Reason"
Install Reason : Installed as a dependency for another package
This task depends upon

Closed by  Dan McGee (toofishes)
Saturday, 05 July 2008, 23:05 GMT
Reason for closing:  Implemented
Additional comments about closing:  --asexplicit in GIT/3.2 will cover this case
Comment by Dan McGee (toofishes) - Friday, 04 July 2008, 14:09 GMT
I believe this is intended behavior, someone correct me if I am wrong. When upgrading packages via the -S/--sync flag, we don't want to lose the original install reason so we keep whatever was there. Pacman 3.2 will introduce an --asexplicit flag which will do what you are looking for.
Comment by Daniel D. (danieldanner) - Friday, 04 July 2008, 16:44 GMT
This solution sounds quite senseful.

Though, it is still unclear why in 3.1.4 "pacman -S" *sometimes* (or on *some* packages) just behaves as 3.2 would do with --asexplicit.

And still I don't have any idea how I should achieve the same result with <3.2.
Comment by Dan McGee (toofishes) - Friday, 04 July 2008, 17:27 GMT
Can you give me an example when it sometimes works? I can't think of any reason this would happen. The three cases:
1. If a package is already installed as a dep and is reinstalled with -S, then it will still be marked as installed as a dep.
2. If a package is already installed as explicit and is reinstalled with -S, then it will still be marked as installed as explicit.
3. If a package is not already installed and installed using -S, then it will be marked as installed as explicit.
Comment by Daniel D. (danieldanner) - Friday, 04 July 2008, 17:49 GMT
> Can you give me an example when it sometimes works?

Hardly, since I did pacman -S <...> in one run for all "affected" packages, noticing some of them still being marked as deps afterwards. The pacman.log probably isn't any useful here...

I'll have a look onto some other machines and will carefully watch for any unexpected behaviour... brb ;)
Comment by Nagy Gabor (combo) - Friday, 04 July 2008, 19:55 GMT
Wow. Good to hear, that our --asexplicit option will not be not useless ;-)

"And still I don't have any idea how I should achieve the same result with <3.2."
I don't want to instruct you to hack your database by hand, so I show you a safe method (the given package is foo):
1. pacman -S foo (maybe -Sy): upgrade/reinstall.
2. _If this was successful_, pacman -Rd foo
3. pacman -S foo
Comment by Nagy Gabor (combo) - Friday, 04 July 2008, 19:58 GMT
Note: Do not try this with crutial packages, like pacman, coreutils, ...
Comment by Daniel D. (danieldanner) - Saturday, 05 July 2008, 11:22 GMT
Honestly, I don't like the idea of having to restore all pacsave-Files after a complete un- and reinstall.

Just right now, I managed to reproduce the behaviour of -S marking a package as explicitely installed.
See this log:

bash-3.2# pacman -Qtd
hwdetect 0.9-1
bash-3.2# pacman -S hwdetect
resolving dependencies...
looking for inter-conflicts...

Targets: hwdetect-0.9-1

Total Download Size: 0.00 MB
Total Installed Size: 0.03 MB

Proceed with installation? [Y/n]
checking package integrity...
(1/1) checking for file conflicts [#############################] 100%
(1/1) installing hwdetect [#############################] 100%
bash-3.2# pacman -Qtd
bash-3.2# pacman -Qi hwdetect | grep "Install Reason"
Install Reason : Explicitly installed

What confuses me here is the fact that it didn't say "... is up to date -- reinstalling". Is that related?
Comment by Nagy Gabor (combo) - Saturday, 05 July 2008, 12:03 GMT
"What confuses me here is the fact that it didn't say "... is up to date -- reinstalling". Is that related?"
That's strange. Can you reproduce it?

"Honestly, I don't like the idea of having to restore all pacsave-Files after a complete un- and reinstall."
Then you should vote to  FS#8645  :-P
Comment by Daniel D. (danieldanner) - Saturday, 05 July 2008, 12:39 GMT
>> What confuses me here is the fact that it didn't say "... is up to date -- reinstalling". Is that related?
> That's strange. Can you reproduce it?

Well, I experienced that every case in which "pacman -S" marked the as explicitely installed didn't show the warning, while it did show on packages that remained their install reason.

> Then you should vote to  FS#8645  :-P
Thanks for the hint. :)
Comment by Nagy Gabor (combo) - Saturday, 05 July 2008, 13:47 GMT
"Well, I experienced that every case in which "pacman -S" marked the as explicitely installed didn't show the warning,"
It shows for me. I looked into the source code too, I don't see any reason it shouldn't show.

Back to the original bug report, imho this can be closed as not a bug, and your feature request will be implemented in 3.2. Is this OK?
Comment by Daniel D. (danieldanner) - Saturday, 05 July 2008, 13:52 GMT
> Is this OK?

As long as no one is concerned about completely unexplained, seemingly random, unexpected behavior, yes. ;)

I'd still be interested in the hacking-the-database way of working around the yet missing --asexplicit flag, since -Rd/-S isn't really comfortable to me, compared to just flipping some bytes in some files (_if_ it isn' more than that).
Comment by Nagy Gabor (combo) - Saturday, 05 July 2008, 14:16 GMT
OK. But this is your responsibility ;-) (Backup first, etc.)
Go into /var/lib/pacman/local/, this is the local database of pacman. In this directory the subdirectories are the database "entries". You will need to edit desc files here.
For example, my pcre package is installed as dependency, I show you how to change this to explicit:
Edit /var/lib/pacman/local/pcre-7.7-1/desc (as root):
You will see 2 lines (probably the last 2 one):
--------
%REASON%
1
--------
Set this 1 to 0.

P.S.: In fact, we don't store %REASON% 0 (In this case, we don't store %REASON% at all).
So alternatively, you can delete the 2 lines listed above (this is the "official" hack).
Comment by Daniel D. (danieldanner) - Saturday, 05 July 2008, 14:20 GMT
Quite comfortable. :)

Thank you!

Loading...