"apt-get purge" Selects another package when the requested package is not installed, but is provided by another package.

Bug #541438 reported by Daniel Hahler
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Binary package hint: apt

I have tried purging "php5-mhash", which has been removed in Lucid (via Conflicts).

"apt-get purge" selected php5-common instead (which now provides php5-mhash) and wanted to purge this package!
This error also applies to "apt-get remove", it will select php5-common instead of php5-mhash.

Apt-get should handle this the same way as any non-installed package, i.e. currently it would say the package is uninstalled and cannot get purged therefore (which is bug 244598).
But in the end, it should just purge the given package, just like "dpkg -P" would do.

ProblemType: Bug
Architecture: i386
Date: Thu Mar 18 19:57:25 2010
DistroRelease: Ubuntu 10.04
NonfreeKernelModules: nvidia
Package: apt 0.7.25.3ubuntu3
ProcEnviron:
 LANGUAGE=
 PATH=(custom, user)
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-16.25-generic
SourcePackage: apt
Uname: Linux 2.6.32-16-generic i686

Revision history for this message
Daniel Hahler (blueyed) wrote :
Changed in apt (Ubuntu):
importance: Undecided → High
summary: - "apt-get purge" should not select another package
+ "apt-get purge" should not select another package (when the requested
+ one in not installed and provided by another one)
Revision history for this message
Micheal Harker (mh0) wrote : Re: "apt-get purge" should not select another package (when the requested one in not installed and provided by another one)

It is certainly possible for ne to fix this if it hasnt been done already.

Changed in apt (Ubuntu):
assignee: nobody → MichealH (michealh)
status: New → Confirmed
Revision history for this message
C de-Avillez (hggdh2) wrote :

@MichealH

Please do not assign yourself to a bug unless you are actively working on resolving the issue.

Also, whenever changing the status or importance of a bug also enter a comment on *why*. For example, you confirmed this one -- what did you do to confirm it?

Resetting Status to New.

Changed in apt (Ubuntu):
assignee: MichealH (michealh) → nobody
status: Confirmed → New
Revision history for this message
Torsten Spindler (tspindler) wrote :

I repeated your steps and installed php5-mhash and then purged php5-mhash. In both cases php5-common was installed, respectively purged.

According to the man page of apt-get this seems to be intended behaviour:

       purge
           purge is identical to remove except that packages are removed and
           purged (any configuration files are deleted too).

       remove
           remove is identical to install except that packages are removed
           instead of installed....

According to your proposal, purge and remove would no longer reflect install. I am not sure if this is a good idea. I set this bug report to incomplete for now, reflecting that the issue has to be given more thought.

Changed in apt (Ubuntu):
status: New → Incomplete
Revision history for this message
Daniel Hahler (blueyed) wrote : Re: "apt-get purge" should not select another package (when the requested one is not installed but provided by another one)

Torsten, php5-common was purged in my case, because it was picked instead of php5-mhash.
The repository layout and dependencies have probably changed since 10.04, but the point is:

If package A gets removed (not purged), and you later want to purge it, the purge action should not pick package B which provides A.
It is just like "apt-get remove A" should never remove B, in case A is not installed.

summary: "apt-get purge" should not select another package (when the requested
- one in not installed and provided by another one)
+ one is not installed but provided by another one)
Changed in apt (Ubuntu):
status: Incomplete → New
Revision history for this message
Julian Andres Klode (juliank) wrote :

A fix has been committed to the debian-sid repository

------------------------------------------------------------
revno: 2120
revision-id: <email address hidden>
parent: <email address hidden>
fixes bug(s): http://bugs.debian.org/150831 https://launchpad.net/bugs/244598
committer: Julian Andres Klode <email address hidden>
branch nick: debian-sid
timestamp: Thu 2011-04-21 12:18:05 +0200
message:
  Make purge work again for config-files (LP: #244598) (Closes: #150831)
diff:
=== modified file 'apt-pkg/depcache.cc'
--- apt-pkg/depcache.cc 2011-04-18 08:56:37 +0000
+++ apt-pkg/depcache.cc 2011-04-21 10:18:05 +0000
@@ -550,7 +550,7 @@
    if (Pkg->CurrentVer == 0)
    {
       if (State.Mode == ModeDelete &&
- (State.iFlags | Purge) == Purge && Pkg.Purge() == false)
+ (State.iFlags & Purge) == Purge && Pkg.Purge() == false)
   iDelCount += Add;

       if (State.Mode == ModeInstall)

=== modified file 'debian/changelog'
--- debian/changelog 2011-04-21 09:25:52 +0000
+++ debian/changelog 2011-04-21 10:18:05 +0000
@@ -2,6 +2,7 @@

   * apt-pkg/depcache.cc:
     - Really release action groups only once (Closes: #622744)
+ - Make purge work again for config-files (LP: #244598) (Closes: #150831)
   * debian/apt.cron.daily:
     - Check power after wait, patch by manuel-soto (LP: #705269)
   * doc/apt-key.8.xml:

Revision history for this message
Julian Andres Klode (juliank) wrote :

Wrong bug, sorry.

description: updated
Evan Peck (colors)
summary: - "apt-get purge" should not select another package (when the requested
- one is not installed but provided by another one)
+ "apt-get purge" Selects another package when the requested package is
+ not installed, but is provided by another package.
Revision history for this message
Evan Peck (colors) wrote :

Sound like this could easily be replicated with using apt-get purge on php5-mhash,
time to confirm?

Revision history for this message
Evan Peck (colors) wrote :

Whoops! Just read 4,5,6.
Let me correct myself,
replicated using:
apt-get install php5-mhash
apt-get remove php5-mhash
//all thats left now are the package's configs//
apt-get purge php5-mhash
//config files still left, purged php5-common//

In 6 juliank said a fix was comitted for debian, couldn't that fix be alsu used for ubuntu/
also, thats another reason to confirm :-)

Evan Peck (colors)
Changed in apt (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel Hahler (blueyed) wrote :

Evan, in comment #7 comment #6 was stated to be meant for another bug.

Current state in Precise (apt 0.8.16~exp5ubuntu14.2) is that "remove" also selects another package.
I cannot say if previously only "purge" was misbehaving, but here we go:

% sudo apt-get install php5-mhash Ubuntu precise (i686)
[...]
Note, selecting 'php5-common' instead of 'php5-mhash'

% sudo apt-get remove php5-mhash Ubuntu precise (i686)
[...]
Note, selecting 'php5-common' instead of 'php5-mhash'

Evan Peck (colors)
description: updated
Changed in apt (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Daniel Hahler (blueyed) wrote :

Could not reproduce it on 13.10 anymore: I have tried to purge php5-mhash, while php5-common was installed.

Changed in apt (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.