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

Bug#827915: initial version number and colon in apt-get download and apt-get autoclean



Package: apt
Version: 1.2.13
Severity: normal
Tags: patch

Hello,

When downloading a package which version contains an initial number
and colon, the saved file name must not include that part of the
version string.

apt-get autoclean removes files which version contains an initial
number and colon, but must not do it.

The attached code is my point of view to solve it,

Regards,
Jordi Pujol i Palomer
From: Jordi Pujol Palomer <jordipujolp@gmail.com>
Subject: apt-get autoclean, strip initial version number and colon
Date: 2016-04-28 16:03:29.613722454 +0200

--- apt-1.2.11-a/apt-pkg/clean.cc
+++ apt-1.2.11-b/apt-pkg/clean.cc	2016-04-28 16:03:29.613722454 +0200
@@ -119,8 +119,14 @@ bool pkgArchiveCleaner::Go(std::string D
 	    }
 	    
 	    // See if this version matches the file
-	    if (IsFetchable == true && Ver == V.VerStr())
-	       break;
+	    if (IsFetchable == true) {
+			if (Start = strchr((const char *)V.VerStr(), ':'))
+				Start++;
+			else
+				Start = V.VerStr();
+			if (strcmp(Ver.c_str(), Start) == 0)
+				break;
+		}
 	 }
 	 
 	 // We found a match, keep the file
From: Jordi Pujol Palomer <jordipujolp@gmail.com>
Subject: apt-get download, strip initial version number and colon
Date: 2016-05-02 08:03:13.887017907 +0200

--- apt-1.2.11-a/apt-pkg/acquire-item.cc
+++ apt-1.2.11-b/apt-pkg/acquire-item.cc	2016-05-02 08:03:13.887017907 +0200
@@ -2896,8 +2896,13 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire
 	 return;
             
       // Generate the final file name as: package_version_arch.foo
+      const char *V;
+      if (V = strchr((const char *)Version.VerStr(), ':'))
+            V++;
+      else
+            V = Version.VerStr();
       StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
-	              QuoteString(Version.VerStr(),"_:") + '_' +
+	              QuoteString(V,"_:") + '_' +
      	              QuoteString(Version.Arch(),"_:.") + 
 	              "." + flExtension(Parse.FileName());
    }

Reply to: