Explorar o código

* apt-pkg/cacheset.cc:
- actually return to the fallback modifier if we have detected we
should for packagenames which look like modifiers (Closes: #669591)

David Kalnischkies %!s(int64=14) %!d(string=hai) anos
pai
achega
e6a12579e9

+ 5 - 2
apt-pkg/cacheset.cc

@@ -217,6 +217,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
 							pkgCacheFile &Cache, const char * cmdline,
 							pkgCacheFile &Cache, const char * cmdline,
 							std::list<Modifier> const &mods, CacheSetHelper &helper) {
 							std::list<Modifier> const &mods, CacheSetHelper &helper) {
 	std::string str = cmdline;
 	std::string str = cmdline;
+	unsigned short fallback = modID;
 	bool modifierPresent = false;
 	bool modifierPresent = false;
 	for (std::list<Modifier>::const_iterator mod = mods.begin();
 	for (std::list<Modifier>::const_iterator mod = mods.begin();
 	     mod != mods.end(); ++mod) {
 	     mod != mods.end(); ++mod) {
@@ -243,6 +244,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P
 		helper.showErrors(errors);
 		helper.showErrors(errors);
 		if (Pkg.end() == false) {
 		if (Pkg.end() == false) {
 			pci->insert(Pkg);
 			pci->insert(Pkg);
+			modID = fallback;
 			return true;
 			return true;
 		}
 		}
 	}
 	}
@@ -281,13 +283,14 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID,
 		modifierPresent = true;
 		modifierPresent = true;
 		break;
 		break;
 	}
 	}
-
 	if (modifierPresent == true) {
 	if (modifierPresent == true) {
 		bool const errors = helper.showErrors(false);
 		bool const errors = helper.showErrors(false);
 		bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
 		bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true);
 		helper.showErrors(errors);
 		helper.showErrors(errors);
-		if (found == true)
+		if (found == true) {
+			modID = fallback;
 			return true;
 			return true;
+		}
 	}
 	}
 	return FromString(vci, Cache, str, select, helper);
 	return FromString(vci, Cache, str, select, helper);
 }
 }

+ 4 - 1
debian/changelog

@@ -12,6 +12,9 @@ apt (0.9.2) unstable; urgency=low
     - do not use the input data directly but memcpy it instead as
     - do not use the input data directly but memcpy it instead as
       it could be unaligned as in the http-transport which causes
       it could be unaligned as in the http-transport which causes
       a sigbus error on sparc (Closes: #669061)
       a sigbus error on sparc (Closes: #669061)
+  * apt-pkg/cacheset.cc:
+    - actually return to the fallback modifier if we have detected we
+      should for packagenames which look like modifiers (Closes: #669591)
 
 
 
 
   [ Malcolm Scott ]
   [ Malcolm Scott ]
@@ -19,7 +22,7 @@ apt (0.9.2) unstable; urgency=low
     - iterate over all pre-depends or-group member instead of looping
     - iterate over all pre-depends or-group member instead of looping
       endlessly over the first member in SmartUnpack (LP: #985852)
       endlessly over the first member in SmartUnpack (LP: #985852)
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 20 Apr 2012 09:52:21 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 20 Apr 2012 10:11:24 +0200
 
 
 apt (0.9.1) unstable; urgency=low
 apt (0.9.1) unstable; urgency=low
 
 

+ 5 - 0
test/integration/test-bug-593360-modifiers-in-names

@@ -15,6 +15,11 @@ The following NEW packages will be installed:
 Inst g++ (4:4.4.5-1 localhost [i386])
 Inst g++ (4:4.4.5-1 localhost [i386])
 Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s
 Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s
 
 
+testequal "Reading package lists...
+Building dependency tree...
+Package 'g++' is not installed, so not removed
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove g++ -s
+
 testequal 'Reading package lists...
 testequal 'Reading package lists...
 Building dependency tree...
 Building dependency tree...
 The following NEW packages will be installed:
 The following NEW packages will be installed: