[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#150831: [apt] Proposed patch to solve this problem



Package: apt
Version: 0.7.25.3

--- Please enter the report below this line. ---

Hi,

I've had a look at the source, and I think the following patch would solve the 
problem. I tested different cases by purging a package in state uninstalled, 
unpacked, installed, and conffiles. The only difference in behavior, is that 
the patched version does not refuse to purge packages in state 'conffiles'.

Please consider applying it.

Regards,

Rogier.

----------------------------- Patch ---------------------------
diff -aur apt-0.7.25.3/cmdline/apt-get.cc apt-0.7.25.3-fix/cmdline/apt-get.cc
--- apt-0.7.25.3/cmdline/apt-get.cc     2010-02-01 20:44:41.000000000 +0100
+++ apt-0.7.25.3-fix/cmdline/apt-get.cc 2010-08-12 12:00:48.000000000 +0200
@@ -1101,7 +1101,7 @@
    
    // Check if there is something at all to install
    pkgDepCache::StateCache &State = Cache[Pkg];
-   if (Remove == true && Pkg->CurrentVer == 0)
+   if (Remove == true && Pkg->CurrentState == pkgCache::State::NotInstalled)
    {
       Fix.Clear(Pkg);
       Fix.Protect(Pkg);
----------------------------- End patch --------------------------

----------------------------- Sample output ---------------------------
root ~ 21 # dpkg-query -l pmount
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
rc  pmount         0.9.23-1       mount removable devices as normal user
root ~ 22 # ./apt-0.7.25.3-fix/debian/apt/usr/bin/apt-get purge -y pmount
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  pmount*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0B of additional disk space will be used.
(Reading database ... 293943 files and directories currently installed.)
Removing pmount ...
Purging configuration files for pmount ...
root ~ 23 # dpkg-query -l pmount
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
un  pmount         <none>         (no description available)
----------------------------- End sample output ---------------------------


--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.32-5-amd64

Debian Release: squeeze/sid
  500 testing         www.debian-multimedia.org 
  500 testing         security.debian.org 
  500 testing         ftp.nl.debian.org 

--- Package information. ---
Depends                       (Version) | Installed
=======================================-+-=============
libc6                        (>= 2.3.4) | 2.11.2-2
libgcc1                    (>= 1:4.1.1) | 1:4.4.4-8
libstdc++6                   (>= 4.4.0) | 4.4.4-8
debian-archive-keyring                  | 2009.01.31


Package's Recommends field is empty.

Suggests        (Version) | Installed
=========================-+-===========
aptitude                  | 0.6.3-3
 OR synaptic              | 0.63.2
 OR wajig                 | 
dpkg-dev                  | 1.15.7.2
apt-doc                   | 
bzip2                     | 1.0.5-4
lzma                      | 4.43-14
python-apt                | 0.7.96.1



--- Output from package bug script ---




Reply to: