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

autoclean: compares different formats of versions, remove files of not installed architectures



Hello,

apt-get autoclean removes files for packages that have ':' '%3a' in the
version string,

apt-cache policy python-ldb libreoffice-common
python-ldb:
  Installed: 2:1.1.20-2
  Candidate: 2:1.1.20-2
  Version table:
 *** 2:1.1.20-2 0
        900 http://ftp.debian.org/debian/ unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     2:1.1.17-2 0
        400 http://ftp.debian.org/debian/ testing/main amd64 Packages
libreoffice-common:
  Installed: 1:4.4.2-1
  Candidate: 1:4.4.2-1
  Version table:
 *** 1:4.4.2-1 0
        900 http://ftp.debian.org/debian/ unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     1:4.3.3-2 0
        400 http://ftp.debian.org/debian/ testing/main amd64 Packages
        900 http://ftp.debian.org/debian/ unstable/main amd64 Packages

The program compares different version formats. Applying the attached
patch, does it right,

Additionally have found in the same source file that we should
remove files corresponding to not installed architectures; probably
this case is not usual, I think that this is the correct behaviour,

Regards,

Jordi Pujol
--- apt-1.0.9.9/apt-pkg/clean.cc	2015-04-28 16:15:25.000000000 +0200
+++ apt-1.0.9.9.lnet.1/apt-pkg/clean.cc	2015-04-30 10:15:58.825164280 +0200
@@ -89,9 +89,11 @@ bool pkgArchiveCleaner::Go(std::string D
 	 continue;
       std::string const Arch = DeQuoteString(std::string(Start,I-Start));
 
-      // ignore packages of unconfigured architectures
-      if (APT::Configuration::checkArchitecture(Arch) == false)
+      // remove packages of unconfigured architectures
+      if (APT::Configuration::checkArchitecture(Arch) == false) {
+	 Erase(Dir->d_name,Pkg,Ver,St);
 	 continue;
+      }
       
       // Lookup the package
       pkgCache::PkgIterator P = Cache.FindPkg(Pkg, Arch);
@@ -113,7 +115,11 @@ bool pkgArchiveCleaner::Go(std::string D
 	    }
 	    
 	    // See if this version matches the file
-	    if (IsFetchable == true && Ver == V.VerStr())
+	    std::string Ver1 = DeQuoteString(Ver);
+	    std::size_t found = Ver.find("%3a");
+	    if (found != std::string::npos)
+	       Ver1 = Ver.substr (found+3);
+	    if (IsFetchable == true && Ver1 == V.VerStr())
 	       break;
 	 }
 	 

Reply to: