From d3eeb2324df154dc2104bbbb98c36d97db69617e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Sep 2008 16:45:34 +0200 Subject: * apt-pkg/pkgcachegen.cc: - do not add multiple identical descriptions for the same language (closes: #400768) --- apt-pkg/pkgcache.cc | 3 ++- apt-pkg/pkgcachegen.cc | 20 ++++++++++++++++---- debian/changelog | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 133899a27..8eb62089a 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -622,7 +622,8 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const for (; Desc.end() == false; Desc++) if (pkgIndexFile::LanguageCode() == Desc.LanguageCode()) break; - if (Desc.end() == true) Desc = DescDefault; + if (Desc.end() == true) + Desc = DescDefault; return Desc; }; diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d00cd4e64..f71547f39 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -139,10 +139,21 @@ bool pkgCacheGenerator::MergeList(ListParser &List, { pkgCache::DescIterator Desc = Ver.DescriptionList(); map_ptrloc *LastDesc = &Ver->DescriptionList; - - for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++) + bool duplicate=false; + + // don't add a new description if we have one for the given + // md5 && language + for ( ; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++) + if (MD5SumValue(Desc.md5()) == CurMd5 && + Desc.LanguageCode() == List.DescriptionLanguage()) + duplicate=true; + if(duplicate) + continue; + + for (Desc = Ver.DescriptionList(); + Desc.end() == false; + LastDesc = &Desc->NextDesc, Desc++) { - if (MD5SumValue(Desc.md5()) == CurMd5) { // Add new description @@ -434,7 +445,8 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc, // --------------------------------------------------------------------- /* This puts a description structure in the linked list */ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc, - const string &Lang, const MD5SumValue &md5sum, + const string &Lang, + const MD5SumValue &md5sum, map_ptrloc Next) { // Get a structure diff --git a/debian/changelog b/debian/changelog index d38b04da2..9ccb807c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -42,6 +42,9 @@ apt (0.7.15) UNRELEASED; urgency=low - add examples/apt-https-method-example.conf * apt-pkg/cacheiterators.h: - add missing checks for Owner == 0 in end() + * apt-pkg/pkgcachegen.cc: + - do not add multiple identical descriptions for the same + language (closes: #400768) [ Dereck Wonnacott ] * apt-ftparchive might write corrupt Release files (LP: #46439) -- cgit v1.2.3