From: Michael Vogt Date: Fri, 3 Aug 2007 09:27:47 +0000 (+0200) Subject: (ABI break) X-Git-Tag: 0.7.24ubuntu1~164^2 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/c3279b9d100fb62f412267512458b58dda40f95b?ds=inline;hp=-c (ABI break) * merged apt--sha256 branch to fully support the new sha256 checksums in the Packages and Release files (ABI break) --- c3279b9d100fb62f412267512458b58dda40f95b diff --combined apt-pkg/acquire-item.cc index 4f5d644ab,6e7c75032..f3784a58b --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@@ -95,7 -95,7 +95,7 @@@ void pkgAcquire::Item::Start(string /*M // Acquire::Item::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ - void pkgAcquire::Item::Done(string Message,unsigned long Size,string, + void pkgAcquire::Item::Done(string Message,unsigned long Size,string Hash, pkgAcquire::MethodConfig *Cnf) { // We just downloaded something.. @@@ -142,8 -142,9 +142,9 @@@ void pkgAcquire::Item::Rename(string Fr */ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - string ExpectedMD5) - : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), Description(URIDesc) + HashString ExpectedHash) + : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), + Description(URIDesc) { Debug = _config->FindB("Debug::pkgAcquire::Diffs",false); @@@ -271,11 -272,11 +272,11 @@@ bool pkgAcqDiffIndex::ParseDiffIndex(st if(found) { // queue the diffs - unsigned int last_space = Description.rfind(" "); + string::size_type last_space = Description.rfind(" "); if(last_space != string::npos) Description.erase(last_space, Description.size()-last_space); new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedMD5, available_patches); + ExpectedHash, available_patches); Complete = false; Status = StatDone; Dequeue(); @@@ -298,7 -299,7 +299,7 @@@ void pkgAcqDiffIndex::Failed(string Mes << "Falling back to normal index file aquire" << std::endl; new pkgAcqIndex(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedMD5); + ExpectedHash); Complete = false; Status = StatDone; @@@ -344,8 -345,9 +345,9 @@@ void pkgAcqDiffIndex::Done(string Messa */ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - string ExpectedMD5, vector diffs) - : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5), + HashString ExpectedMD5, + vector diffs) + : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), available_patches(diffs) { @@@ -378,7 -380,7 +380,7 @@@ void pkgAcqIndexDiffs::Failed(string Me std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << std::endl << "Falling back to normal index file aquire" << std::endl; new pkgAcqIndex(Owner, RealURI, Description,Desc.ShortDesc, - ExpectedMD5); + ExpectedHash); Finish(); } @@@ -393,14 -395,7 +395,7 @@@ void pkgAcqIndexDiffs::Finish(bool allD DestFile = _config->FindDir("Dir::State::lists"); DestFile += URItoFileName(RealURI); - // do the final md5sum checking - MD5Summation sum; - FileFd Fd(DestFile, FileFd::ReadOnly); - sum.AddFD(Fd.Fd(), Fd.Size()); - Fd.Close(); - string MD5 = (string)sum.Result(); - - if (!ExpectedMD5.empty() && MD5 != ExpectedMD5) + if(!ExpectedHash.empty() && !ExpectedHash.VerifyFile(DestFile)) { Status = StatAuthError; ErrorText = _("MD5Sum mismatch"); @@@ -542,7 -537,7 +537,7 @@@ void pkgAcqIndexDiffs::Done(string Mess // see if there is more to download if(available_patches.size() > 0) { new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedMD5, available_patches); + ExpectedHash, available_patches); return Finish(); } else return Finish(true); @@@ -556,8 -551,8 +551,8 @@@ instantiated to fetch the revision file */ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, - string ExpectedMD5, string comprExt) - : Item(Owner), RealURI(URI), ExpectedMD5(ExpectedMD5) + HashString ExpectedHash, string comprExt) + : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash) { Decompression = false; Erase = false; @@@ -608,7 -603,7 +603,7 @@@ void pkgAcqIndex::Failed(string Message // retry with a gzip one new pkgAcqIndex(Owner, RealURI, Desc.Description,Desc.ShortDesc, - ExpectedMD5, string(".gz")); + ExpectedHash, string(".gz")); Status = StatDone; Complete = false; Dequeue(); @@@ -633,32 -628,23 +628,23 @@@ to the uncompressed version of the file. If this is so the file is copied into the partial directory. In all other cases the file is decompressed with a gzip uri. */ - void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5, + void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash, pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,MD5,Cfg); + Item::Done(Message,Size,Hash,Cfg); if (Decompression == true) { if (_config->FindB("Debug::pkgAcquire::Auth", false)) { - std::cerr << std::endl << RealURI << ": Computed MD5: " << MD5; - std::cerr << " Expected MD5: " << ExpectedMD5 << std::endl; - } - - if (MD5.empty()) - { - MD5Summation sum; - FileFd Fd(DestFile, FileFd::ReadOnly); - sum.AddFD(Fd.Fd(), Fd.Size()); - Fd.Close(); - MD5 = (string)sum.Result(); + std::cerr << std::endl << RealURI << ": Computed Hash: " << Hash; + std::cerr << " Expected Hash: " << ExpectedHash.toStr() << std::endl; } - if (!ExpectedMD5.empty() && MD5 != ExpectedMD5) + if (!ExpectedHash.empty() && ExpectedHash.toStr() != Hash) { Status = StatAuthError; - ErrorText = _("MD5Sum mismatch"); + ErrorText = _("Hash Sum mismatch"); Rename(DestFile,DestFile + ".FAILED"); return; } @@@ -688,10 -674,8 +674,10 @@@ { // The files timestamp matches if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true) + { + unlink(FileName.c_str()); return; - + } Decompression = true; Local = true; DestFile += ".decomp"; @@@ -710,10 -694,7 +696,10 @@@ // The files timestamp matches if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true) + { + unlink(FileName.c_str()); return; + } if (FileName == DestFile) Erase = true; @@@ -742,8 -723,8 +728,8 @@@ // --------------------------------------------------------------------- /* The Translation file is added to the queue */ pkgAcqIndexTrans::pkgAcqIndexTrans(pkgAcquire *Owner, - string URI,string URIDesc,string ShortDesc) : - pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, "", "") + string URI,string URIDesc,string ShortDesc) + : pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, HashString(), "") { } @@@ -920,10 -901,10 +906,10 @@@ string pkgAcqMetaIndex::Custom600Header return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime); } - void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string MD5, + void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash, pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,MD5,Cfg); + Item::Done(Message,Size,Hash,Cfg); // MetaIndexes are done in two passes: one to download the // metaindex with an appropriate method, and a second to verify it @@@ -985,18 -966,18 +971,18 @@@ void pkgAcqMetaIndex::RetrievalDone(str // see if the download was a IMSHit IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false); - Complete = true; string FinalFile = _config->FindDir("Dir::State::lists"); FinalFile += URItoFileName(RealURI); - // The files timestamp matches - if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == false) - { - // Move it into position + // If we get a IMS hit we can remove the empty file in partial + // othersie we move the file in place + if (IMSHit) + unlink(DestFile.c_str()); + else Rename(DestFile,FinalFile); - } + chmod(FinalFile.c_str(),0644); DestFile = FinalFile; } @@@ -1041,7 -1022,7 +1027,7 @@@ void pkgAcqMetaIndex::QueueIndexes(boo Target != IndexTargets->end(); Target++) { - string ExpectedIndexMD5; + HashString ExpectedIndexHash; if (verify) { const indexRecords::checkSum *Record = MetaIndexParser->Lookup((*Target)->MetaKey); @@@ -1052,16 -1033,16 +1038,16 @@@ + (*Target)->MetaKey + " in Meta-index file (malformed Release file?)"; return; } - ExpectedIndexMD5 = Record->MD5Hash; + ExpectedIndexHash = Record->Hash; if (_config->FindB("Debug::pkgAcquire::Auth", false)) { std::cerr << "Queueing: " << (*Target)->URI << std::endl; - std::cerr << "Expected MD5: " << ExpectedIndexMD5 << std::endl; + std::cerr << "Expected Hash: " << ExpectedIndexHash.toStr() << std::endl; } - if (ExpectedIndexMD5.empty()) + if (ExpectedIndexHash.empty()) { Status = StatAuthError; - ErrorText = "Unable to find MD5 sum for " + ErrorText = "Unable to find hash sum for " + (*Target)->MetaKey + " in Meta-index file"; return; } @@@ -1071,10 -1052,10 +1057,10 @@@ // on the users option) if(_config->FindB("Acquire::PDiffs",true) == true) new pkgAcqDiffIndex(Owner, (*Target)->URI, (*Target)->Description, - (*Target)->ShortDesc, ExpectedIndexMD5); + (*Target)->ShortDesc, ExpectedIndexHash); else new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, - (*Target)->ShortDesc, ExpectedIndexMD5); + (*Target)->ShortDesc, ExpectedIndexHash); } } @@@ -1314,7 -1295,12 +1300,12 @@@ bool pkgAcqArchive::QueueNext( return false; string PkgFile = Parse.FileName(); - MD5 = Parse.MD5Hash(); + if(Parse.SHA256Hash() != "") + ExpectedHash = HashString("SHA256", Parse.SHA256Hash()); + else if (Parse.SHA1Hash() != "") + ExpectedHash = HashString("SHA1", Parse.SHA1Hash()); + else + ExpectedHash = HashString("MD5Sum", Parse.MD5Hash()); if (PkgFile.empty() == true) return _error->Error(_("The package index files are corrupted. No Filename: " "field for package %s."), @@@ -1394,10 -1380,10 +1385,10 @@@ // AcqArchive::Done - Finished fetching /*{{{*/ // --------------------------------------------------------------------- /* */ - void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash, + void pkgAcqArchive::Done(string Message,unsigned long Size,string CalcHash, pkgAcquire::MethodConfig *Cfg) { - Item::Done(Message,Size,Md5Hash,Cfg); + Item::Done(Message,Size,CalcHash,Cfg); // Check the size if (Size != Version->Size) @@@ -1407,17 -1393,14 +1398,14 @@@ return; } - // Check the md5 - if (Md5Hash.empty() == false && MD5.empty() == false) + // Check the hash + if(ExpectedHash.toStr() != CalcHash) { - if (Md5Hash != MD5) - { - Status = StatError; - ErrorText = _("MD5Sum mismatch"); - if(FileExists(DestFile)) - Rename(DestFile,DestFile + ".FAILED"); - return; - } + Status = StatError; + ErrorText = _("Hash Sum mismatch"); + if(FileExists(DestFile)) + Rename(DestFile,DestFile + ".FAILED"); + return; } // Grab the output filename @@@ -1509,10 -1492,10 +1497,10 @@@ void pkgAcqArchive::Finished( // AcqFile::pkgAcqFile - Constructor /*{{{*/ // --------------------------------------------------------------------- /* The file is added to the queue */ - pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5, + pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, unsigned long Size,string Dsc,string ShortDesc, const string &DestDir, const string &DestFilename) : - Item(Owner), Md5Hash(MD5) + Item(Owner), ExpectedHash(Hash) { Retries = _config->FindI("Acquire::Retries",0); @@@ -1549,23 -1532,20 +1537,20 @@@ // AcqFile::Done - Item downloaded OK /*{{{*/ // --------------------------------------------------------------------- /* */ - void pkgAcqFile::Done(string Message,unsigned long Size,string MD5, + void pkgAcqFile::Done(string Message,unsigned long Size,string CalcHash, pkgAcquire::MethodConfig *Cnf) { - // Check the md5 - if (Md5Hash.empty() == false && MD5.empty() == false) + Item::Done(Message,Size,CalcHash,Cnf); + + // Check the hash + if(!ExpectedHash.empty() && ExpectedHash.toStr() != CalcHash) { - if (Md5Hash != MD5) - { - Status = StatError; - ErrorText = "MD5Sum mismatch"; - Rename(DestFile,DestFile + ".FAILED"); - return; - } + Status = StatError; + ErrorText = "Hash Sum mismatch"; + Rename(DestFile,DestFile + ".FAILED"); + return; } - Item::Done(Message,Size,MD5,Cnf); - string FileName = LookupTag(Message,"Filename"); if (FileName.empty() == true) { diff --combined cmdline/apt-get.cc index b216204d2,fb1bb248e..c9ec481aa --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@@ -918,7 -918,7 +918,7 @@@ bool InstallPackages(CacheFile &Cache,b pkgAcquire::UriIterator I = Fetcher.UriBegin(); for (; I != Fetcher.UriEnd(); I++) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << - I->Owner->FileSize << ' ' << I->Owner->MD5Sum() << endl; + I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; return true; } @@@ -1359,7 -1359,7 +1359,7 @@@ bool DoUpdate(CommandLine &CmdL pkgAcquire::UriIterator I = Fetcher.UriBegin(); for (; I != Fetcher.UriEnd(); I++) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << - I->Owner->FileSize << ' ' << I->Owner->MD5Sum() << endl; + I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; return true; } @@@ -2211,7 -2211,7 +2211,7 @@@ bool DoSource(CommandLine &CmdL pkgAcquire::UriIterator I = Fetcher.UriBegin(); for (; I != Fetcher.UriEnd(); I++) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << - I->Owner->FileSize << ' ' << I->Owner->MD5Sum() << endl; + I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; return true; } @@@ -2582,8 -2582,8 +2582,8 @@@ bool DoMoo(CommandLine &CmdL /* */ bool ShowHelp(CommandLine &CmdL) { - ioprintf(cout,_("%s %s for %s %s compiled on %s %s\n"),PACKAGE,VERSION, - COMMON_OS,COMMON_CPU,__DATE__,__TIME__); + ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION, + COMMON_ARCH,__DATE__,__TIME__); if (_config->FindB("version") == true) { diff --combined debian/changelog index 8c0bc2d0e,8961a0257..c730f85b0 --- a/debian/changelog +++ b/debian/changelog @@@ -1,45 -1,14 +1,48 @@@ -apt (0.7.5) UNRELEASED; urgency=low +apt (0.7.7) UNRELEASED; urgency=low + + * apt-inst/contrib/extracttar.cc: + - fix fd leak for zero size files (thanks to Bill Broadley for + reporting this bug) + * apt-pkg/acquire-item.cc: + - remove zero size files on I-M-S hit + * methods/https.cc: + - only send LastModified if we actually have one + - send range request with if-range + - delete failed downloads + * apt-pkg/deb/dpkgpm.{cc,h}: + - merged dpkg-log branch, this lets you specify a + Dir::Log::Terminal file to log dpkg output to - ABI break ++ (ABI break) ++ * merged apt--sha256 branch to fully support the new ++ sha256 checksums in the Packages and Release files ++ (ABI break) + + -- Michael Vogt Thu, 02 Aug 2007 11:55:54 +0200 + +apt (0.7.6) unstable; urgency=low + + * Applied patch from Aurelien Jarno to fix wrong + directory downloading on non-linux architectures (closes: #435597) + + -- Otavio Salvador Wed, 01 Aug 2007 19:49:51 -0300 + +apt (0.7.5) unstable; urgency=low [ Otavio Salvador ] - * Applied patch from Guillem Jover to use + * Applied patch from Guillem Jover to use dpkg-architecture to get the host architecture (closes: #407187) + * Applied patch from Guillem Jover to add + support to add lzma support (closes: #408201) [ Michael Vogt ] * apt-pkg/depcache.cc: - support a list of sections for: APT::Install-Recommends-Sections APT::Never-MarkAuto-Sections + * methods/makefile: + - install lzma symlink method (for full lzma support) + * debian/control: + - suggest "lzma" -- Otavio Salvador Wed, 25 Jul 2007 20:16:46 -0300