Michael Vogt лет назад: 14
Родитель
Сommit
4bf36b4cfa

+ 16 - 17
apt-pkg/algorithms.cc

@@ -475,7 +475,7 @@ pkgProblemResolver::pkgProblemResolver(pkgDepCache *pCache) : Cache(*pCache)
 {
    // Allocate memory
    unsigned long Size = Cache.Head().PackageCount;
-   Scores = new signed short[Size];
+   Scores = new int[Size];
    Flags = new unsigned char[Size];
    memset(Flags,0,sizeof(*Flags)*Size);
    
@@ -515,20 +515,20 @@ void pkgProblemResolver::MakeScores()
    memset(Scores,0,sizeof(*Scores)*Size);
 
    // Important Required Standard Optional Extra
-   signed short PrioMap[] = {
+   int PrioMap[] = {
       0,
-      (signed short) _config->FindI("pkgProblemResolver::Scores::Important",3),
-      (signed short) _config->FindI("pkgProblemResolver::Scores::Required",2),
-      (signed short) _config->FindI("pkgProblemResolver::Scores::Standard",1),
-      (signed short) _config->FindI("pkgProblemResolver::Scores::Optional",-1),
-      (signed short) _config->FindI("pkgProblemResolver::Scores::Extra",-2)
+      _config->FindI("pkgProblemResolver::Scores::Important",3),
+      _config->FindI("pkgProblemResolver::Scores::Required",2),
+      _config->FindI("pkgProblemResolver::Scores::Standard",1),
+      _config->FindI("pkgProblemResolver::Scores::Optional",-1),
+      _config->FindI("pkgProblemResolver::Scores::Extra",-2)
    };
-   signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
-   signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);
-   signed short PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1);
-   signed short PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1);
-   signed short AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000);
-   signed short AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000);
+   int PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100);
+   int PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1);
+   int PrioDepends = _config->FindI("pkgProblemResolver::Scores::Depends",1);
+   int PrioRecommends = _config->FindI("pkgProblemResolver::Scores::Recommends",1);
+   int AddProtected = _config->FindI("pkgProblemResolver::Scores::AddProtected",10000);
+   int AddEssential = _config->FindI("pkgProblemResolver::Scores::AddEssential",5000);
 
    if (_config->FindB("Debug::pkgProblemResolver::ShowScores",false) == true)
       clog << "Settings used to calculate pkgProblemResolver::Scores::" << endl
@@ -550,7 +550,7 @@ void pkgProblemResolver::MakeScores()
       if (Cache[I].InstallVer == 0)
 	 continue;
       
-      signed short &Score = Scores[I->ID];
+      int &Score = Scores[I->ID];
       
       /* This is arbitrary, it should be high enough to elevate an
          essantial package above most other packages but low enough
@@ -588,7 +588,7 @@ void pkgProblemResolver::MakeScores()
    }   
    
    // Copy the scores to advoid additive looping
-   SPtrArray<signed short> OldScores = new signed short[Size];
+   SPtrArray<int> OldScores = new int[Size];
    memcpy(OldScores,Scores,sizeof(*Scores)*Size);
       
    /* Now we cause 1 level of dependency inheritance, that is we add the 
@@ -1098,8 +1098,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
 		  LEnd->Dep = End;
 		  LEnd++;
 		  
-		  if (Start->Type != pkgCache::Dep::Conflicts &&
-		      Start->Type != pkgCache::Dep::Obsoletes)
+		  if (Start.IsNegative() == false)
 		     break;
 	       }
 	    }

+ 1 - 1
apt-pkg/algorithms.h

@@ -96,7 +96,7 @@ class pkgProblemResolver						/*{{{*/
    enum Flags {Protected = (1 << 0), PreInstalled = (1 << 1),
                Upgradable = (1 << 2), ReInstateTried = (1 << 3),
                ToRemove = (1 << 4)};
-   signed short *Scores;
+   int *Scores;
    unsigned char *Flags;
    bool Debug;
    

+ 58 - 9
apt-pkg/aptconfiguration.cc

@@ -20,6 +20,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <stdio.h>
+#include <fcntl.h>
 
 #include <algorithm>
 #include <string>
@@ -328,16 +329,63 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
 	// FIXME: It is a bit unclean to have debian specific code here…
 	if (archs.empty() == true) {
 		archs.push_back(arch);
-		string dpkgcall = _config->Find("Dir::Bin::dpkg", "dpkg");
-		std::vector<string> const dpkgoptions = _config->FindVector("DPkg::options");
-		for (std::vector<string>::const_iterator o = dpkgoptions.begin();
-		     o != dpkgoptions.end(); ++o)
-			dpkgcall.append(" ").append(*o);
-		dpkgcall.append(" --print-foreign-architectures 2> /dev/null");
-		FILE *dpkg = popen(dpkgcall.c_str(), "r");
+
+		// Generate the base argument list for dpkg
+		std::vector<const char *> Args;
+		string Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+		{
+			string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/");
+			size_t dpkgChrootLen = dpkgChrootDir.length();
+			if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0) {
+				if (dpkgChrootDir[dpkgChrootLen - 1] == '/')
+					--dpkgChrootLen;
+				Tmp = Tmp.substr(dpkgChrootLen);
+			}
+		}
+		Args.push_back(Tmp.c_str());
+
+		// Stick in any custom dpkg options
+		::Configuration::Item const *Opts = _config->Tree("DPkg::Options");
+		if (Opts != 0) {
+			Opts = Opts->Child;
+			for (; Opts != 0; Opts = Opts->Next)
+			{
+				if (Opts->Value.empty() == true)
+					continue;
+				Args.push_back(Opts->Value.c_str());
+			}
+		}
+
+		Args.push_back("--print-foreign-architectures");
+		Args.push_back(NULL);
+
+		int external[2] = {-1, -1};
+		if (pipe(external) != 0)
+		{
+			_error->WarningE("getArchitecture", "Can't create IPC pipe for dpkg --print-foreign-architectures");
+			return archs;
+		}
+
+		pid_t dpkgMultiArch = ExecFork();
+		if (dpkgMultiArch == 0) {
+			close(external[0]);
+			std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory");
+			if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
+				_error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --print-foreign-architectures", chrootDir.c_str());
+			int const nullfd = open("/dev/null", O_RDONLY);
+			dup2(nullfd, STDIN_FILENO);
+			dup2(external[1], STDOUT_FILENO);
+			dup2(nullfd, STDERR_FILENO);
+			execv(Args[0], (char**) &Args[0]);
+			_error->WarningE("getArchitecture", "Can't detect foreign architectures supported by dpkg!");
+			_exit(100);
+		}
+		close(external[1]);
+
+		FILE *dpkg = fdopen(external[0], "r");
 		char buf[1024];
 		if(dpkg != NULL) {
-			if (fgets(buf, sizeof(buf), dpkg) != NULL) {
+			while (fgets(buf, sizeof(buf), dpkg) != NULL) {
 				char* arch = strtok(buf, " ");
 				while (arch != NULL) {
 					for (; isspace(*arch) != 0; ++arch);
@@ -349,8 +397,9 @@ std::vector<std::string> const Configuration::getArchitectures(bool const &Cache
 					arch = strtok(NULL, " ");
 				}
 			}
-			pclose(dpkg);
+			fclose(dpkg);
 		}
+		ExecWait(dpkgMultiArch, "dpkg --print-foreign-architectures", true);
 		return archs;
 	}
 

+ 1 - 1
apt-pkg/cacheiterators.h

@@ -207,7 +207,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
 	inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;};
 	inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;};
 	inline const char *Arch() const {
-		if (S->MultiArch == pkgCache::Version::All)
+		if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All)
 			return "all";
 		return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
 	};

+ 8 - 2
apt-pkg/contrib/configuration.cc

@@ -185,8 +185,14 @@ string Configuration::FindFile(const char *Name,const char *Default) const
    }
    
    string val = Itm->Value;
-   while (Itm->Parent != 0 && Itm->Parent->Value.empty() == false)
-   {	 
+   while (Itm->Parent != 0)
+   {
+      if (Itm->Parent->Value.empty() == true)
+      {
+	 Itm = Itm->Parent;
+	 continue;
+      }
+
       // Absolute
       if (val.length() >= 1 && val[0] == '/')
          break;

+ 18 - 6
apt-pkg/contrib/fileutl.cc

@@ -867,6 +867,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Co
    else
       iFd = open(FileName.c_str(), fileflags, Perms);
 
+   this->FileName = FileName;
    if (iFd == -1 || OpenInternDescriptor(Mode, compressor) == false)
    {
       if (iFd != -1)
@@ -877,7 +878,6 @@ bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Co
       return _error->Errno("open",_("Could not open file %s"), FileName.c_str());
    }
 
-   this->FileName = FileName;
    SetCloseExec(iFd,true);
    return true;
 }
@@ -916,13 +916,13 @@ bool FileFd::OpenDescriptor(int Fd, unsigned int const Mode, APT::Configuration:
    d->openmode = Mode;
    Flags = (AutoClose) ? FileFd::AutoClose : 0;
    iFd = Fd;
+   this->FileName = "";
    if (OpenInternDescriptor(Mode, compressor) == false)
    {
       if (AutoClose)
 	 close (iFd);
       return _error->Errno("gzdopen",_("Could not open file descriptor %d"), Fd);
    }
-   this->FileName = "";
    return true;
 }
 bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::Compressor const &compressor)
@@ -1057,11 +1057,21 @@ bool FileFd::Read(void *To,unsigned long long Size,unsigned long long *Actual)
       else
 #endif
          Res = read(iFd,To,Size);
-      if (Res < 0 && errno == EINTR)
-	 continue;
+
       if (Res < 0)
       {
+	 if (errno == EINTR)
+	    continue;
 	 Flags |= Fail;
+#if APT_USE_ZLIB
+	 if (d->gz != NULL)
+	 {
+	    int err;
+	    char const * const errmsg = gzerror(d->gz, &err);
+	    if (err != Z_ERRNO)
+	       return _error->Error("gzread: %s (%d: %s)", _("Read error"), err, errmsg);
+	 }
+#endif
 	 return _error->Errno("read",_("Read error"));
       }
       
@@ -1337,6 +1347,7 @@ unsigned long long FileFd::Size()
    // gzopen in "direct" mode as well
    else if (d->gz && !gzdirect(d->gz) && size > 0)
    {
+       off_t const oldPos = lseek(iFd,0,SEEK_CUR);
        /* unfortunately zlib.h doesn't provide a gzsize(), so we have to do
 	* this ourselves; the original (uncompressed) file size is the last 32
 	* bits of the file */
@@ -1354,8 +1365,9 @@ unsigned long long FileFd::Size()
        size = tmp_size;
 #endif
 
-       if (lseek(iFd, d->seekpos, SEEK_SET) < 0)
+       if (lseek(iFd, oldPos, SEEK_SET) < 0)
 	   return _error->Errno("lseek","Unable to seek in gzipped file");
+
        return size;
    }
 #endif
@@ -1405,7 +1417,7 @@ bool FileFd::Close()
 #if APT_USE_ZLIB
       if (d != NULL && d->gz != NULL) {
 	 int const e = gzclose(d->gz);
-	 // gzdopen() on empty files always fails with "buffer error" here, ignore that
+	 // gzdclose() on empty files always fails with "buffer error" here, ignore that
 	 if (e != 0 && e != Z_BUF_ERROR)
 	    Res &= _error->Errno("close",_("Problem closing the gzip file %s"), FileName.c_str());
       } else

+ 1 - 1
apt-pkg/contrib/mmap.cc

@@ -85,7 +85,7 @@ bool MMap::Map(FileFd &Fd)
 	 return _error->Error("Compressed file %s can only be mapped readonly", Fd.Name().c_str());
       Base = new unsigned char[iSize];
       if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
-	 return false;
+	 return _error->Error("Compressed file %s can't be read into mmap", Fd.Name().c_str());
       return true;
    }
 

+ 39 - 19
apt-pkg/deb/dpkgpm.cc

@@ -123,6 +123,18 @@ ionice(int PID)
    return ExecWait(Process, "ionice");
 }
 
+// dpkgChrootDirectory - chrooting for dpkg if needed			/*{{{*/
+static void dpkgChrootDirectory()
+{
+   std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory");
+   if (chrootDir == "/")
+      return;
+   std::cerr << "Chrooting into " << chrootDir << std::endl;
+   if (chroot(chrootDir.c_str()) != 0)
+      _exit(100);
+}
+									/*}}}*/
+
 // DPkgPM::pkgDPkgPM - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -328,15 +340,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
 	 SetCloseExec(STDIN_FILENO,false);      
 	 SetCloseExec(STDERR_FILENO,false);
 
-	 if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") 
-	 {
-	    std::cerr << "Chrooting into " 
-		      << _config->FindDir("DPkg::Chroot-Directory") 
-		      << std::endl;
-	    if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0)
-	       _exit(100);
-	 }
-
+	 dpkgChrootDirectory();
 	 const char *Args[4];
 	 Args[0] = "/bin/sh";
 	 Args[1] = "-c";
@@ -832,7 +836,17 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // Generate the base argument list for dpkg
    std::vector<const char *> Args;
    unsigned long StartSize = 0;
-   string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   string Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   {
+      string const dpkgChrootDir = _config->FindDir("DPkg::Chroot-Directory", "/");
+      size_t dpkgChrootLen = dpkgChrootDir.length();
+      if (dpkgChrootDir != "/" && Tmp.find(dpkgChrootDir) == 0)
+      {
+	 if (dpkgChrootDir[dpkgChrootLen - 1] == '/')
+	    --dpkgChrootLen;
+	 Tmp = Tmp.substr(dpkgChrootLen);
+      }
+   }
    Args.push_back(Tmp.c_str());
    StartSize += Tmp.length();
 
@@ -858,6 +872,12 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    pid_t dpkgAssertMultiArch = ExecFork();
    if (dpkgAssertMultiArch == 0)
    {
+      dpkgChrootDirectory();
+      // redirect everything to the ultimate sink as we only need the exit-status
+      int const nullfd = open("/dev/null", O_RDONLY);
+      dup2(nullfd, STDIN_FILENO);
+      dup2(nullfd, STDOUT_FILENO);
+      dup2(nullfd, STDERR_FILENO);
       execv(Args[0], (char**) &Args[0]);
       _error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!");
       _exit(2);
@@ -1085,7 +1105,14 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    }
 	    else
 	    {
-	       char * const fullname = strdup(I->Pkg.FullName(false).c_str());
+	       pkgCache::VerIterator PkgVer;
+	       std::string name = I->Pkg.Name();
+	       if (Op == Item::Remove || Op == Item::Purge)
+		  PkgVer = I->Pkg.CurrentVer();
+	       else
+		  PkgVer = Cache[I->Pkg].InstVerIter(Cache);
+	       name.append(":").append(PkgVer.Arch());
+	       char * const fullname = strdup(name.c_str());
 	       Packages.push_back(fullname);
 	       ADDARG(fullname);
 	    }
@@ -1190,14 +1217,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	 }
 	 close(fd[0]); // close the read end of the pipe
 
-	 if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") 
-	 {
-	    std::cerr << "Chrooting into " 
-		      << _config->FindDir("DPkg::Chroot-Directory") 
-		      << std::endl;
-	    if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0)
-	       _exit(100);
-	 }
+	 dpkgChrootDirectory();
 
 	 if (chdir(_config->FindDir("DPkg::Run-Directory","/").c_str()) != 0)
 	    _exit(100);

+ 28 - 11
apt-pkg/depcache.cc

@@ -1240,19 +1240,36 @@ void pkgDepCache::SetReInstall(PkgIterator const &Pkg,bool To)
    if (unlikely(Pkg.end() == true))
       return;
 
+   APT::PackageList pkglist;
+   if (Pkg->CurrentVer != 0 &&
+       (Pkg.CurrentVer()-> MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
+   {
+      pkgCache::GrpIterator Grp = Pkg.Group();
+      for (pkgCache::PkgIterator P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P))
+      {
+	 if (P->CurrentVer != 0)
+	    pkglist.insert(P);
+      }
+   }
+   else
+      pkglist.insert(Pkg);
+
    ActionGroup group(*this);
 
-   RemoveSizes(Pkg);
-   RemoveStates(Pkg);
-   
-   StateCache &P = PkgState[Pkg->ID];
-   if (To == true)
-      P.iFlags |= ReInstall;
-   else
-      P.iFlags &= ~ReInstall;
-   
-   AddStates(Pkg);
-   AddSizes(Pkg);
+   for (APT::PackageList::const_iterator Pkg = pkglist.begin(); Pkg != pkglist.end(); ++Pkg)
+   {
+      RemoveSizes(Pkg);
+      RemoveStates(Pkg);
+
+      StateCache &P = PkgState[Pkg->ID];
+      if (To == true)
+	 P.iFlags |= ReInstall;
+      else
+	 P.iFlags &= ~ReInstall;
+
+      AddStates(Pkg);
+      AddSizes(Pkg);
+   }
 }
 									/*}}}*/
 // DepCache::SetCandidateVersion - Change the candidate version		/*{{{*/

+ 13 - 8
apt-pkg/packagemanager.cc

@@ -322,22 +322,22 @@ bool pkgPackageManager::ConfigureAll()
    only shown when debuging*/
 bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
 {
-   // If this is true, only check and correct and dependancies without the Loop flag
+   // If this is true, only check and correct and dependencies without the Loop flag
    bool PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop);
 
    if (Debug) {
       VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer);
       clog << OutputInDepth(Depth) << "SmartConfigure " << Pkg.Name() << " (" << InstallVer.VerStr() << ")";
       if (PkgLoop)
-        clog << " (Only Correct Dependancies)";
+        clog << " (Only Correct Dependencies)";
       clog << endl;
    }
 
    VerIterator const instVer = Cache[Pkg].InstVerIter(Cache);
       
-   /* Because of the ordered list, most dependancies should be unpacked, 
+   /* Because of the ordered list, most dependencies should be unpacked, 
       however if there is a loop (A depends on B, B depends on A) this will not 
-      be the case, so check for dependancies before configuring. */
+      be the case, so check for dependencies before configuring. */
    bool Bad = false;
    for (DepIterator D = instVer.DependsList();
 	D.end() == false; )
@@ -424,7 +424,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
 	 
 	 if (Start==End) {
 	    if (Bad && Debug && List->IsFlag(DepPkg,pkgOrderList::Loop) == false)
-		  std::clog << OutputInDepth(Depth) << "Could not satisfy dependancies for " << Pkg.Name() << std::endl;
+		  std::clog << OutputInDepth(Depth) << "Could not satisfy dependencies for " << Pkg.Name() << std::endl;
 	    break;
 	 } else {
             Start++;
@@ -529,7 +529,6 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg)
    List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
 
    return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge);
-   return true;
 }
 									/*}}}*/
 // PM::SmartUnPack - Install helper					/*{{{*/
@@ -682,7 +681,13 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 	    VerIterator Ver(Cache,*I);
 	    PkgIterator BrokenPkg = Ver.ParentPkg();
 	    VerIterator InstallVer(Cache,Cache[BrokenPkg].InstallVer);
-	    
+	    if (BrokenPkg.CurrentVer() != Ver)
+	    {
+	       if (Debug)
+		  std::clog << OutputInDepth(Depth) << "  Ignore not-installed version " << Ver.VerStr() << " of " << Pkg.FullName() << " for " << End << std::endl;
+	       continue;
+	    }
+
 	    // Check if it needs to be unpacked
 	    if (List->IsFlag(BrokenPkg,pkgOrderList::InList) && Cache[BrokenPkg].Delete() == false && 
 	        List->IsNow(BrokenPkg)) {
@@ -733,7 +738,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
 
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
 
-   if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same)
+   if (Immediate == true && (instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
    {
       /* Do lockstep M-A:same unpacking in two phases:
 	 First unpack all installed architectures, then the not installed.

+ 11 - 5
cmdline/apt-get.cc

@@ -1730,7 +1730,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	      Pkg != tooMuch.end() && Changed == false; ++Pkg)
 	 {
 	    APT::PackageSet too;
-	    too.insert(Pkg);
+	    too.insert(*Pkg);
 	    for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
 		 Prv.end() == false; ++Prv)
 	       too.insert(Prv.ParentPkg());
@@ -2863,21 +2863,27 @@ bool DoBuildDep(CommandLine &CmdL)
 	       if ((BADVER(Ver)) == false)
 	       {
 		  string forbidden;
-		  if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All);
+		  if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All)
+		  {
+		     if (colon == string::npos)
+		     {
+			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
+		     }
+		  }
 		  else if (Ver->MultiArch == pkgCache::Version::Same)
 		  {
-		     if (colon != string::npos)
+		     if (colon == string::npos)
 			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);
 		     else if (strcmp(D->Package.c_str() + colon, ":any") == 0)
 			forbidden = "Multi-Arch: same";
 		     // :native gets the buildArch
 		  }
-		  else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+		  else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
 		  {
 		     if (colon != string::npos)
 			forbidden = "Multi-Arch: foreign";
 		  }
-		  else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+		  else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
 		  {
 		     if (colon == string::npos)
 			Pkg = Ver.ParentPkg().Group().FindPkg(hostArch);

+ 1 - 1
debian/apt.cron.daily

@@ -8,7 +8,7 @@
 #  Dir "/";
 #  - RootDir for all configuration files
 #
-#  Dir::Cache "var/apt/cache/";
+#  Dir::Cache "var/cache/apt/";
 #  - Set apt package cache directory
 #
 #  Dir::Cache::Archives "archives/";

+ 91 - 6
debian/changelog

@@ -1,4 +1,79 @@
-apt (0.8.16~exp10) UNRELEASED; urgency=low
+apt (0.8.16~exp13) UNRELEASED; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - chroot if needed before dpkg --assert-multi-arch
+    - ensure that dpkg binary doesn't have the chroot-directory prefixed
+  * apt-pkg/depcache.cc:
+    - if a M-A:same package is marked for reinstall, mark all it's installed
+      silbings for reinstallation as well (LP: #859188)
+  * apt-pkg/contrib/configuration.cc:
+    - do not stop parent transversal in FindDir if the value is empty
+  * methods/http{s,}.cc:
+    - if a file without an extension is requested send an 'Accept: text/*'
+      header to avoid that the server chooses unsupported compressed files
+      in a content-negotation attempt (Closes: #657560)
+  * apt-pkg/aptconfiguration.cc:
+    - chroot if needed before calling dpkg --print-foreign-architectures
+
+  [ Steve Langasek ]
+  * cmdline/apt-get.cc:
+    - for cross-build-dependencies M-A: none should be DEB_HOST_ARCH,
+      not DEB_BUILD_ARCH (Closes: #646288)
+
+  [ Colin Watson ]
+  * apt-pkg/algorithms.cc:
+    - don't break out of the main-resolver loop for Breaks to deal with all
+      of them in a single iteration (Closes: #657695, LP: #922485)
+    - use a signed int instead of short for score calculation as upgrades
+      become so big now that it can overflow (Closes: #657732, LP: #917173)
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 30 Jan 2012 19:17:09 +0100
+
+apt (0.8.16~exp12) experimental; urgency=low
+
+  [ Michael Vogt ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - fix segfault on pkg removal
+
+  [ David Kalnischkies ]
+  * apt-pkg/cacheiterators.h:
+    - return the correct version arch for all+foreign, too
+  * apt-pkg/packagemanager.cc:
+    - ignore breaks on not-installed versions while searching for
+      breakage loops as we don't have to avoid them
+  * debian/control:
+    - remove APT from the short descriptions as lintian doesn't like it
+      and it doesn't transport any information for a reader anyway
+    - apply typofixes by Pascal De Vuyst, thanks! (Closes: #652834, #652835)
+  * debian/rules:
+    - apply patch to enable usage of hardning CPPFLAGS and LDFLAGS by
+      Moritz Muehlenhoff, thanks! (Closes: #653504)
+  * methods/https.cc:
+    - use curls list append instead of appending Range and If-Range by hand
+      which generates malformed requests, thanks Mel Collins for the hint!
+      (Closes: #646381)
+  * test/libapt/run-tests:
+    - hurd doesn't have dmesg yet and we don't really need it either,
+      so use with $0 a more stable data source for hashsumming
+
+  [ Pino Toscano ]
+  * test/libapt/globalerror_test.cc:
+    - errno 0 has a different strerror on hurd, so generate the expected
+      message dynamically instead of hardcoding 'Success' (Closes: #656530)
+
+ -- Michael Vogt <mvo@debian.org>  Tue, 24 Jan 2012 12:24:38 +0100
+
+apt (0.8.16~exp11) experimental; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - redirect out/input of dpkg --assert-multi-arch to /dev/null
+    - if multi-arch is detected ensure that pkg:all is reported as pkg:all
+
+ -- Michael Vogt <mvo@debian.org>  Thu, 19 Jan 2012 13:48:18 +0100
+
+apt (0.8.16~exp10) experimental; urgency=low
 
   [ David Kalnischkies ]
   * apt-pkg/depcache.cc:
@@ -9,12 +84,15 @@ apt (0.8.16~exp10) UNRELEASED; urgency=low
   * apt-pkg/deb/dpkgpm.cc:
     - check if dpkg supports multiarch with --assert-multi-arch
       and if it does be always explicit about the architecture
+  * apt-pkg/contrib/fileutl.h:
+    - store the offset in the internal fd before calculate size of
+      the zlib-handled file to jump back to this place again
 
   [ Michael Vogt ]
-  * apt-pkg/contrib/fileutils.h:
-    - fix segfault from python-apt testsuite
+  * apt-pkg/contrib/fileutl.h:
+    - fix segfault triggered by the python-apt testsuite
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 13 Jan 2012 17:29:07 +0100
+ -- Michael Vogt <mvo@debian.org>  Wed, 18 Jan 2012 12:52:26 +0100
 
 apt (0.8.16~exp9) experimental; urgency=low
 
@@ -264,6 +342,10 @@ apt (0.8.15.10) UNRELEASEDunstable; urgency=low
     - show a debug why a package was kept by ResolveByKeep()
   * doc/manpage-style.xml:
     - put <brackets> around email addresses
+  * apt-pkg/aptconfiguration.cc:
+    - parse dpkg --print-foreign-architectures correctly in
+      case archs are separated by newline instead of space, too.
+      (Closes: #655590)
   * doc/po/de.po:
     - apply typo-fix from Michael Basse, thanks! (LP: #900770)
 
@@ -272,10 +354,13 @@ apt (0.8.15.10) UNRELEASEDunstable; urgency=low
   * doc/*.xml:
     - find and fix a bunch of misspellings
 
-  [ Program translation updatex ]
+  [ Program translation updates ]
   * Dutch (Jeroen Schot). Closes: #652230
+  * Slovak (Ivan Masar). Closes: #652985
+  * Russian (Yuri Kozlov). Closes: #654844
+  * Hungarian (Gabor Kelemen). Closes: #655238
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 06 Dec 2011 16:35:39 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 13 Jan 2012 17:30:36 +0100
 
 apt (0.8.15.9) unstable; urgency=low
 

+ 12 - 12
debian/control

@@ -7,8 +7,8 @@ Uploaders: Michael Vogt <mvo@debian.org>, Otavio Salvador <otavio@debian.org>,
  Julian Andres Klode <jak@debian.org>
 Standards-Version: 3.9.2
 Build-Depends: dpkg-dev (>= 1.15.8), debhelper (>= 8.1.3~), libdb-dev,
- gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0), 
- zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml, 
+ gettext (>= 0.12), libcurl4-gnutls-dev (>= 7.19.0),
+ zlib1g-dev | libz-dev, debiandoc-sgml, xsltproc, docbook-xsl, docbook-xml,
  po4a (>= 0.34-2), autotools-dev, autoconf, automake, doxygen
 Build-Conflicts: autoconf2.13, automake1.4
 Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/
@@ -20,7 +20,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, debian-archive-keyring, gnupg
 Replaces: manpages-pl (<< 20060617-3~)
 Conflicts: python-apt (<< 0.7.93.2~)
 Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt
-Description: APT's commandline package manager
+Description: commandline package manager
  This package provides commandline tools for searching and
  managing as well as querying information about packages
  as a low-level access to all features of the libapt-pkg library.
@@ -40,7 +40,7 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT's package managment runtime library
+Description: package managment runtime library
  This library provides the common functionality for searching and
  managing packages as well as information about packages.
  Higher-level package managers can depend upon this library.
@@ -61,8 +61,8 @@ Architecture: any
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT's deb package format runtime library
- This library provides methods to query and extract information 
+Description: deb package format runtime library
+ This library provides methods to query and extract information
  from deb packages. This includes the control data and the package
  file content.
 
@@ -71,7 +71,7 @@ Architecture: all
 Priority: optional
 Depends: ${misc:Depends}
 Section: doc
-Description: Documentation for APT
+Description: documentation for APT
  This package contains the user guide and offline guide for various
  APT tools which are provided in a html and a text-only version.
 
@@ -82,7 +82,7 @@ Priority: optional
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${libapt-pkg-name} (= ${binary:Version}), ${libapt-inst-name} (= ${binary:Version}), ${misc:Depends}, zlib1g-dev | zlib-dev
 Section: libdevel
-Description: Development files for APT's libapt-pkg and libapt-inst
+Description: development files for APT's libapt-pkg and libapt-inst
  This package contains the header files and libraries for
  developing with APT's libapt-pkg Debian package manipulation
  library and the libapt-inst deb/tar/ar library.
@@ -92,7 +92,7 @@ Architecture: all
 Priority: optional
 Depends: ${misc:Depends}
 Section: doc
-Description: Documentation for APT development
+Description: documentation for APT development
  This package contains documentation for development of the APT
  Debian package manipulation program and its libraries.
  .
@@ -102,7 +102,7 @@ Description: Documentation for APT development
 Package: apt-utils
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: APT utility programs
+Description: package managment related utility programs
  This package contains some less used commandline utilities related
  to package managment with APT.
  .
@@ -120,7 +120,7 @@ Description: https download transport for APT
  This package enables the usage of 'deb https://foo distro main' lines
  in the /etc/apt/sources.list so that all package managers using the
  libapt-pkg library can access metadata and packages available in sources
- accessable over https (Hypertext Transfer Protocol Secure).
+ accessible over https (Hypertext Transfer Protocol Secure).
  .
- This transport supports server as well as client authenification
+ This transport supports server as well as client authentication
  with certificates.

+ 3 - 1
debian/rules

@@ -19,6 +19,8 @@ endif
 
 ifneq (,$(shell which dpkg-buildflags))
   export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
+  export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
+  export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
 else
   ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
     export CXXFLAGS = -O0 -g -Wall
@@ -92,7 +94,7 @@ build/configure-stamp: configure
 	dh_testdir
 	-mkdir build
 	cp COPYING debian/copyright
-	cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
+	cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
 	touch $@
 
 build/build-stamp: build/configure-stamp

+ 10 - 2
methods/gpgv.cc

@@ -98,8 +98,16 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile,
       // Read a line.  Sigh.
       while ((c = getc(pipein)) != EOF && c != '\n')
       {
-         if (bufferoff == buffersize)
-            buffer = (char *) realloc(buffer, buffersize *= 2);
+	 if (bufferoff == buffersize)
+	 {
+	    char* newBuffer = (char *) realloc(buffer, buffersize *= 2);
+	    if (newBuffer == NULL)
+	    {
+	       free(buffer);
+	       return "Couldn't allocate a buffer big enough for reading";
+	    }
+	    buffer = newBuffer;
+	 }
          *(buffer+bufferoff) = c;
          bufferoff++;
       }

+ 13 - 1
methods/http.cc

@@ -716,7 +716,19 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
       }
    }
 
-   
+   // If we ask for uncompressed files servers might respond with content-
+   // negotation which lets us end up with compressed files we do not support,
+   // see 657029, 657560 and co, so if we have no extension on the request
+   // ask for text only. As a sidenote: If there is nothing to negotate servers
+   // seem to be nice and ignore it.
+   if (_config->FindB("Acquire::http::SendAccept", true) == true)
+   {
+      size_t const filepos = Itm->Uri.find_last_of('/');
+      string const file = Itm->Uri.substr(filepos + 1);
+      if (flExtension(file) == file)
+	 strcat(Buf,"Accept: text/*\r\n");
+   }
+
    string Req = Buf;
 
    // Check for a partial file

+ 18 - 5
methods/https.cc

@@ -100,7 +100,6 @@ void HttpsMethod::SetupProxy()  					/*{{{*/
    depth. */
 bool HttpsMethod::Fetch(FetchItem *Itm)
 {
-   stringstream ss;
    struct stat SBuf;
    struct curl_slist *headers=NULL;  
    char curl_errorstr[CURL_ERROR_SIZE];
@@ -199,6 +198,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
       if (_config->FindB("Acquire::https::No-Store",
 		_config->FindB("Acquire::http::No-Store",false)) == true)
 	 headers = curl_slist_append(headers,"Cache-Control: no-store");
+      stringstream ss;
       ioprintf(ss, "Cache-Control: max-age=%u", _config->FindI("Acquire::https::Max-Age",
 		_config->FindI("Acquire::http::Max-Age",0)));
       headers = curl_slist_append(headers, ss.str().c_str());
@@ -242,15 +242,28 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    // error handling
    curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errorstr);
 
+   // If we ask for uncompressed files servers might respond with content-
+   // negotation which lets us end up with compressed files we do not support,
+   // see 657029, 657560 and co, so if we have no extension on the request
+   // ask for text only. As a sidenote: If there is nothing to negotate servers
+   // seem to be nice and ignore it.
+   if (_config->FindB("Acquire::https::SendAccept", _config->FindB("Acquire::http::SendAccept", true)) == true)
+   {
+      size_t const filepos = Itm->Uri.find_last_of('/');
+      string const file = Itm->Uri.substr(filepos + 1);
+      if (flExtension(file) == file)
+	 headers = curl_slist_append(headers, "Accept: text/*");
+   }
+
    // if we have the file send an if-range query with a range header
    if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0)
    {
       char Buf[1000];
-      sprintf(Buf,"Range: bytes=%li-\r\nIf-Range: %s\r\n",
-	      (long)SBuf.st_size - 1,
-	      TimeRFC1123(SBuf.st_mtime).c_str());
+      sprintf(Buf, "Range: bytes=%li-", (long) SBuf.st_size - 1);
       headers = curl_slist_append(headers, Buf);
-   } 
+      sprintf(Buf, "If-Range: %s", TimeRFC1123(SBuf.st_mtime).c_str());
+      headers = curl_slist_append(headers, Buf);
+   }
    else if(Itm->LastModified > 0)
    {
       curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);

+ 6 - 1
methods/rred.cc

@@ -333,7 +333,12 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From,		/*{{{*/
 		}
 		if(command_count == command_alloc) {
 			command_alloc = (command_alloc + 64) * 3 / 2;
-			commands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+			EdCommand* newCommands = (EdCommand*) realloc(commands, command_alloc * sizeof(EdCommand));
+			if (newCommands == NULL) {
+				free(commands);
+				return MMAP_FAILED;
+			}
+			commands = newCommands;
 		}
 		commands[command_count++] = cmd;
 	}

Разница между файлами не показана из-за своего большого размера
+ 922 - 837
po/hu.po


Разница между файлами не показана из-за своего большого размера
+ 411 - 382
po/ru.po


Разница между файлами не показана из-за своего большого размера
+ 314 - 285
po/sk.po


+ 8 - 1
test/integration/framework

@@ -25,7 +25,14 @@ msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; }
 msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; }
 msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; }
 msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; }
-msgtest() { echo -n "${CINFO}$1 ${CCMD}$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} …${CNORMAL} " >&2; }
+msgtest() {
+	while [ -n "$1" ]; do
+		echo -n "${CINFO}$1${CCMD} " >&2;
+		echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2;
+		shift 2
+	done
+	echo -n "…${CNORMAL} " >&2;
+}
 msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; }
 msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; }
 msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; }

+ 18 - 0
test/integration/test-bug-612958-use-dpkg-multiarch-config

@@ -56,4 +56,22 @@ testfail 'dpkg config' 'armel'
 echo '#! /bin/sh
 echo "amd64 armel"' > ./dpkg-printer
 
+testpass 'dpkg config' 'i386'
+testpass 'dpkg config' 'amd64'
+testpass 'dpkg config' 'armel'
+
+echo '#! /bin/sh
+echo "amd64
+armel"' > ./dpkg-printer
+
+testpass 'dpkg config' 'i386'
+testpass 'dpkg config' 'amd64'
 testpass 'dpkg config' 'armel'
+
+echo '#! /bin/sh
+echo "amd64
+i386"' > ./dpkg-printer
+
+testpass 'dpkg config' 'i386'
+testpass 'dpkg config' 'amd64'
+testfail 'dpkg config' 'armel'

+ 63 - 24
test/integration/test-bug-632221-cross-dependency-satisfaction

@@ -6,43 +6,51 @@ TESTDIR=$(readlink -f $(dirname $0))
 setupenvironment
 configarchitecture 'amd64' 'armel'
 
-insertinstalledpackage 'build-essential' 'all' '11.5'
+insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign'
 
-insertpackage 'unstable' 'doxygen' 'amd64,armel' '1.0'
+insertpackage 'unstable' 'doxygen' 'amd64,armel' '1.0' 'Multi-Arch: foreign'
 insertpackage 'unstable' 'libc6' 'amd64,armel' '1.0' 'Multi-Arch: same'
 insertpackage 'unstable' 'libc6-dev' 'amd64,armel' '1.0' 'Depends: libc6
 Multi-Arch: same'
+insertpackage 'unstable' 'libfwibble1' 'amd64,armel' '1.0' 'Depends: libc6
+Multi-Arch: same'
+insertpackage 'unstable' 'libfwibble-dev' 'amd64,armel' '1.0' 'Depends: libfwibble1'
 insertpackage 'unstable' 'cool' 'amd64,armel' '1.0' 'Multi-Arch: allowed'
 insertpackage 'unstable' 'amdboot' 'amd64' '1.0'
 insertpackage 'unstable' 'foreigner' 'amd64,armel' '1.0' 'Multi-Arch: foreign'
 
-insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner'
+insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev'
 
 setupaptarchive
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
-  amdboot cool doxygen foreigner libc6 libc6-dev
-0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
+  amdboot cool doxygen foreigner libc6 libc6-dev libfwibble-dev libfwibble1
+0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
 Inst amdboot (1.0 unstable [amd64])
 Inst cool (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
 Inst foreigner (1.0 unstable [amd64])
 Inst libc6 (1.0 unstable [amd64])
 Inst libc6-dev (1.0 unstable [amd64])
+Inst libfwibble1 (1.0 unstable [amd64])
+Inst libfwibble-dev (1.0 unstable [amd64])
 Conf amdboot (1.0 unstable [amd64])
 Conf cool (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
 Conf foreigner (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [amd64])
-Conf libc6-dev (1.0 unstable [amd64])' aptget build-dep apt -s
+Conf libc6-dev (1.0 unstable [amd64])
+Conf libfwibble1 (1.0 unstable [amd64])
+Conf libfwibble-dev (1.0 unstable [amd64])' aptget build-dep apt -s
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
   amdboot cool doxygen foreigner libc6 libc6:armel libc6-dev libc6-dev:armel
-0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
+  libfwibble-dev:armel libfwibble1:armel
+0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
 Inst amdboot (1.0 unstable [amd64])
 Inst cool (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
@@ -51,6 +59,8 @@ Inst libc6 (1.0 unstable [amd64])
 Inst libc6:armel (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [amd64])
 Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libfwibble1:armel (1.0 unstable [armel])
+Inst libfwibble-dev:armel (1.0 unstable [armel])
 Conf amdboot (1.0 unstable [amd64])
 Conf cool (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
@@ -58,34 +68,41 @@ Conf foreigner (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [amd64])
 Conf libc6:armel (1.0 unstable [armel])
 Conf libc6-dev (1.0 unstable [amd64])
-Conf libc6-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel
+Conf libc6-dev:armel (1.0 unstable [armel])
+Conf libfwibble1:armel (1.0 unstable [armel])
+Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel
 
 configarchitecture 'armel' 'amd64'
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
-  amdboot:amd64 cool doxygen foreigner libc6 libc6-dev
-0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
+  amdboot:amd64 cool doxygen foreigner libc6 libc6-dev libfwibble-dev
+  libfwibble1
+0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
 Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst cool (1.0 unstable [armel])
 Inst doxygen (1.0 unstable [armel])
 Inst foreigner (1.0 unstable [armel])
 Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [armel])
+Inst libfwibble1 (1.0 unstable [armel])
+Inst libfwibble-dev (1.0 unstable [armel])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf cool (1.0 unstable [armel])
 Conf doxygen (1.0 unstable [armel])
 Conf foreigner (1.0 unstable [armel])
 Conf libc6 (1.0 unstable [armel])
-Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s
+Conf libc6-dev (1.0 unstable [armel])
+Conf libfwibble1 (1.0 unstable [armel])
+Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
   amdboot:amd64 cool doxygen foreigner libc6:amd64 libc6 libc6-dev:amd64
-  libc6-dev
-0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
+  libc6-dev libfwibble-dev:amd64 libfwibble1:amd64
+0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
 Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst cool (1.0 unstable [armel])
 Inst doxygen (1.0 unstable [armel])
@@ -94,6 +111,8 @@ Inst libc6:amd64 (1.0 unstable [amd64])
 Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev:amd64 (1.0 unstable [amd64])
 Inst libc6-dev (1.0 unstable [armel])
+Inst libfwibble1:amd64 (1.0 unstable [amd64])
+Inst libfwibble-dev:amd64 (1.0 unstable [amd64])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf cool (1.0 unstable [armel])
 Conf doxygen (1.0 unstable [armel])
@@ -101,7 +120,9 @@ Conf foreigner (1.0 unstable [armel])
 Conf libc6:amd64 (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [armel])
 Conf libc6-dev:amd64 (1.0 unstable [amd64])
-Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s -a amd64
+Conf libc6-dev (1.0 unstable [armel])
+Conf libfwibble1:amd64 (1.0 unstable [amd64])
+Conf libfwibble-dev:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64
 
 configarchitecture 'amd64' 'armel'
 
@@ -111,34 +132,43 @@ insertinstalledpackage 'foreigner' 'armel' '0.5'
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
-  amdboot doxygen libc6 libc6-dev
-0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded.
+  amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1
+0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
 Inst amdboot (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
 Inst libc6 (1.0 unstable [amd64])
 Inst libc6-dev (1.0 unstable [amd64])
+Inst libfwibble1 (1.0 unstable [amd64])
+Inst libfwibble-dev (1.0 unstable [amd64])
 Conf amdboot (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [amd64])
-Conf libc6-dev (1.0 unstable [amd64])' aptget build-dep apt -s
+Conf libc6-dev (1.0 unstable [amd64])
+Conf libfwibble1 (1.0 unstable [amd64])
+Conf libfwibble-dev (1.0 unstable [amd64])' aptget build-dep apt -s
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
   amdboot doxygen libc6 libc6:armel libc6-dev libc6-dev:armel
-0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
+  libfwibble-dev:armel libfwibble1:armel
+0 upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
 Inst amdboot (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
 Inst libc6 (1.0 unstable [amd64])
 Inst libc6:armel (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [amd64])
 Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libfwibble1:armel (1.0 unstable [armel])
+Inst libfwibble-dev:armel (1.0 unstable [armel])
 Conf amdboot (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [amd64])
 Conf libc6:armel (1.0 unstable [armel])
 Conf libc6-dev (1.0 unstable [amd64])
-Conf libc6-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel
+Conf libc6-dev:armel (1.0 unstable [armel])
+Conf libfwibble1:armel (1.0 unstable [armel])
+Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel
 
 configarchitecture 'armel' 'amd64'
 
@@ -148,36 +178,45 @@ Building dependency tree...
 The following packages will be REMOVED:
   cool:amd64
 The following NEW packages will be installed:
-  amdboot:amd64 cool doxygen libc6 libc6-dev
-0 upgraded, 5 newly installed, 1 to remove and 1 not upgraded.
+  amdboot:amd64 cool doxygen libc6 libc6-dev libfwibble-dev libfwibble1
+0 upgraded, 7 newly installed, 1 to remove and 1 not upgraded.
 Remv cool:amd64 [0.5]
 Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst cool (1.0 unstable [armel])
 Inst doxygen (1.0 unstable [armel])
 Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [armel])
+Inst libfwibble1 (1.0 unstable [armel])
+Inst libfwibble-dev (1.0 unstable [armel])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf cool (1.0 unstable [armel])
 Conf doxygen (1.0 unstable [armel])
 Conf libc6 (1.0 unstable [armel])
-Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s
+Conf libc6-dev (1.0 unstable [armel])
+Conf libfwibble1 (1.0 unstable [armel])
+Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s
 
 testequal 'Reading package lists...
 Building dependency tree...
 The following NEW packages will be installed:
   amdboot:amd64 doxygen libc6:amd64 libc6 libc6-dev:amd64 libc6-dev
-0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
+  libfwibble-dev:amd64 libfwibble1:amd64
+0 upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
 Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [armel])
 Inst libc6:amd64 (1.0 unstable [amd64])
 Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev:amd64 (1.0 unstable [amd64])
 Inst libc6-dev (1.0 unstable [armel])
+Inst libfwibble1:amd64 (1.0 unstable [amd64])
+Inst libfwibble-dev:amd64 (1.0 unstable [amd64])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [armel])
 Conf libc6:amd64 (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [armel])
 Conf libc6-dev:amd64 (1.0 unstable [amd64])
-Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s -a amd64
+Conf libc6-dev (1.0 unstable [armel])
+Conf libfwibble1:amd64 (1.0 unstable [amd64])
+Conf libfwibble-dev:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64
 
 

+ 51 - 0
test/integration/test-bug-657695-resolver-breaks-on-virtuals

@@ -0,0 +1,51 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'xserver-xorg-core' 'amd64' '2:1.7.6-2ubuntu7.10'
+for i in $(seq 1 50); do
+	insertinstalledpackage "xserver-xorg-video-driver$i" 'amd64' '1.0' 'Provides: xserver-xorg-video-6'
+done
+
+insertpackage 'unstable' 'xserver-xorg-core' 'amd64' '2:1.11.3-0ubuntu9' 'Breaks: xserver-xorg-video-6'
+
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+  xserver-xorg-video-driver1 xserver-xorg-video-driver10
+  xserver-xorg-video-driver11 xserver-xorg-video-driver12
+  xserver-xorg-video-driver13 xserver-xorg-video-driver14
+  xserver-xorg-video-driver15 xserver-xorg-video-driver16
+  xserver-xorg-video-driver17 xserver-xorg-video-driver18
+  xserver-xorg-video-driver19 xserver-xorg-video-driver2
+  xserver-xorg-video-driver20 xserver-xorg-video-driver21
+  xserver-xorg-video-driver22 xserver-xorg-video-driver23
+  xserver-xorg-video-driver24 xserver-xorg-video-driver25
+  xserver-xorg-video-driver26 xserver-xorg-video-driver27
+  xserver-xorg-video-driver28 xserver-xorg-video-driver29
+  xserver-xorg-video-driver3 xserver-xorg-video-driver30
+  xserver-xorg-video-driver31 xserver-xorg-video-driver32
+  xserver-xorg-video-driver33 xserver-xorg-video-driver34
+  xserver-xorg-video-driver35 xserver-xorg-video-driver36
+  xserver-xorg-video-driver37 xserver-xorg-video-driver38
+  xserver-xorg-video-driver39 xserver-xorg-video-driver4
+  xserver-xorg-video-driver40 xserver-xorg-video-driver41
+  xserver-xorg-video-driver42 xserver-xorg-video-driver43
+  xserver-xorg-video-driver44 xserver-xorg-video-driver45
+  xserver-xorg-video-driver46 xserver-xorg-video-driver47
+  xserver-xorg-video-driver48 xserver-xorg-video-driver49
+  xserver-xorg-video-driver5 xserver-xorg-video-driver50
+  xserver-xorg-video-driver6 xserver-xorg-video-driver7
+  xserver-xorg-video-driver8 xserver-xorg-video-driver9
+The following packages will be upgraded:
+  xserver-xorg-core
+1 upgraded, 0 newly installed, 50 to remove and 0 not upgraded.
+After this operation, 2150 kB disk space will be freed.
+E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only

+ 47 - 3
test/integration/test-dpkg-assert-multi-arch

@@ -9,19 +9,29 @@ configarchitecture 'amd64' 'i386'
 buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable'
 buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign'
 buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same'
+buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable'
+buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign'
 
 setupaptarchive
 
 testqualifier() {
-	msgtest 'Test for correct qualifier mode' $2
-	GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -- '--configure' | sed -e 's/^.*--configure \([^ ]*\).*$/\1/')"
-	test "$GIVEN" = "$2" && msgpass || msgfail
+	msgtest 'Test with' $1 'for correct qualifier mode' $2
+	GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
+	if [ "$GIVEN" = "$2" ]; then
+		msgpass
+	else
+		echo
+		echo "$GIVEN"
+		msgfail
+	fi
 }
 
 # non-multiarch or "ubuntus" old multiarchified dpkg
 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
 echo '#! /bin/sh
 if echo "$*" | grep -q -- "--assert-multi-arch"; then
+	echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
+	echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
 	return 2;
 fi
 return $*' > ./dpkg-wrapper
@@ -34,9 +44,27 @@ testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
 testqualifier 'same-lib' 'same-lib'
 testqualifier 'same-lib:amd64' 'same-lib'
 testqualifier 'same-lib:i386' 'same-lib:i386'
+testqualifier 'all-pkg' 'all-pkg'
+testqualifier 'all-pkg:amd64' 'all-pkg'
+testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
+testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
+insertinstalledpackage 'all-pkg' 'amd64' '1.0'
+insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
+testqualifier 'all-pkg' 'all-pkg'
+testqualifier 'all-pkg:amd64' 'all-pkg'
+testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
+testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
+insertinstalledpackage 'always-all-pkg' 'all' '1.0'
+insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
+testqualifier 'all-pkg-' 'all-pkg'
+testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
+testqualifier 'always-all-pkg-' 'always-all-pkg'
+testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
 
 # multiarch dpkg (new interface version)
 
+rm rootdir/var/lib/dpkg/status
+touch rootdir/var/lib/dpkg/status
 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
 echo '#! /bin/sh
 if echo "$*" | grep -q -- "--assert-multi-arch"; then
@@ -51,3 +79,19 @@ testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
 testqualifier 'same-lib' 'same-lib:amd64'
 testqualifier 'same-lib:amd64' 'same-lib:amd64'
 testqualifier 'same-lib:i386' 'same-lib:i386'
+testqualifier 'all-pkg' 'all-pkg:all'
+testqualifier 'all-pkg:amd64' 'all-pkg:all'
+testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
+testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
+insertinstalledpackage 'all-pkg' 'amd64' '1.0'
+insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
+testqualifier 'all-pkg' 'all-pkg:all'
+testqualifier 'all-pkg:amd64' 'all-pkg:all'
+testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
+testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
+insertinstalledpackage 'always-all-pkg' 'all' '1.0'
+insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
+testqualifier 'all-pkg-' 'all-pkg:amd64'
+testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64'
+testqualifier 'always-all-pkg-' 'always-all-pkg:all'
+testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all'

+ 56 - 0
test/integration/test-ordering-ignore-not-matching-breaks

@@ -0,0 +1,56 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertpackage 'unstable-mp' 'crda' 'i386,amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda
+Multi-Arch: foreign'
+insertpackage 'unstable-m' 'crda' 'i386,amd64' '1.1.1-1ubuntu4m' 'Multi-Arch: foreign'
+insertpackage 'unstable-p' 'crda' 'i386,amd64' '1.1.1-1ubuntu4p' 'Provides: wireless-crda'
+insertpackage 'unstable' 'wireless-crda' 'i386,amd64' '1.16'
+
+
+insertinstalledpackage 'wireless-crda' 'amd64' '1.14'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  crda
+0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+Inst crda (1.1.1-1ubuntu4m unstable-m [amd64])
+Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  crda
+0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+Inst crda (1.1.1-1ubuntu4p unstable-p [amd64])
+Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  crda
+0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+Inst crda (1.1.1-1ubuntu4mp unstable-mp [amd64])
+Conf crda (1.1.1-1ubuntu4mp unstable-mp [amd64])' aptget install crda -s -t unstable-mp
+
+rm rootdir/var/lib/dpkg/status
+insertinstalledpackage 'crda' 'amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda
+Conflicts: wireless-crda (<< 1.15)
+Replaces: wireless-crda ( << 1.15)
+Multi-arch: foreign'
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  wireless-crda
+0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+Inst wireless-crda (1.16 unstable [amd64])
+Conf wireless-crda (1.16 unstable [amd64])' aptget install wireless-crda -s -t unstable

+ 28 - 0
test/integration/test-ubuntu-bug-859188-multiarch-reinstall

@@ -0,0 +1,28 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386' 'armel'
+
+buildsimplenativepackage 'libsame' 'amd64,i386,armel' '1.0' 'unstable' 'Multi-Arch: same'
+
+# FIXME: hack around dpkg's current inability to handle multiarch, a clean install would be better…
+insertinstalledpackage 'libsame' 'amd64,i386' '1.0' 'Multi-Arch: same'
+sed -e 's#/installed#/unstable#' -e 's#Installed-Size: 42#Installed-Size: 1#' -i rootdir/var/lib/dpkg/status
+
+setupaptarchive
+
+REINSTALL='Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
+Inst libsame [1.0] (1.0 unstable [amd64])
+Inst libsame:i386 [1.0] (1.0 unstable [i386])
+Conf libsame (1.0 unstable [amd64])
+Conf libsame:i386 (1.0 unstable [i386])'
+
+testequal "$REINSTALL" aptget install --reinstall libsame -s
+testequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s
+testequal "$REINSTALL" aptget install --reinstall libsame:i386 -s
+testequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s

+ 9 - 0
test/libapt/configuration_test.cc

@@ -71,6 +71,15 @@ int main(int argc,const char *argv[]) {
 	equals(Cnf.Find("APT2::Version", "33"), "33");
 	equals(Cnf.FindI("APT2::Version", 33), 33);
 
+	equals(Cnf.FindFile("Dir::State"), "");
+	equals(Cnf.FindFile("Dir::Aptitude::State"), "");
+	Cnf.Set("Dir", "/srv/sid");
+	equals(Cnf.FindFile("Dir::State"), "");
+	Cnf.Set("Dir::State", "var/lib/apt");
+	Cnf.Set("Dir::Aptitude::State", "var/lib/aptitude");
+	equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt");
+	equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude");
+
 	//FIXME: Test for configuration file parsing;
 	// currently only integration/ tests test them implicitly
 

+ 5 - 2
test/libapt/globalerror_test.cc

@@ -3,9 +3,12 @@
 #include "assert.h"
 #include <string>
 #include <errno.h>
+#include <string.h>
 
 int main(int argc,char *argv[])
 {
+	std::string const textOfErrnoZero(strerror(0));
+
 	equals(_error->empty(), true);
 	equals(_error->PendingError(), false);
 	equals(_error->Notice("%s Notice", "A"), false);
@@ -80,7 +83,7 @@ int main(int argc,char *argv[])
 	equals(_error->PendingError(), true);
 	equals(_error->PopMessage(text), true);
 	equals(_error->PendingError(), false);
-	equals(text, "Something horrible happend 2 times - errno (0: Success)");
+	equals(text, std::string("Something horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 	equals(_error->empty(), true);
 
 	std::string longText;
@@ -92,7 +95,7 @@ int main(int argc,char *argv[])
 
 	equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happend", 2), false);
 	equals(_error->PopMessage(text), true);
-	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: Success)"));
+	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 
 	equals(_error->Warning("Репозиторий не обновлён и будут %d %s", 4, "test"), false);
 	equals(_error->PopMessage(text), false);

+ 1 - 3
test/libapt/run-tests

@@ -67,11 +67,9 @@ do
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
 	elif [ $name = "HashSums${EXT}" ]; then
-		TMP="$(mktemp)"
-		dmesg > $TMP
+		TMP="$(readlink -f "./${0}")"
 		echo -n "Testing with \033[1;35m${name}\033[0m ... "
 		LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
-		rm $TMP
 		continue
 	elif [ $name = "CompareVersion${EXT}" ]; then
 		tmppath="${DIR}/versions.lst"