summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-05-15 14:37:33 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-05-15 14:37:33 +0200
commitbc1c9081e826c2c7f265f23d388ba868d5011f6a (patch)
tree4e4b234c82b24d6b7ab00bc31c1e974b3ac12320 /apt-pkg/deb
parent2af2eb53e867bfcc0422aaf3c93c79eb2c93e9cc (diff)
Never parse Version/Architecture tags in a Translation-$lang file
Version/Architecture information in a Translation-$lang file is not allowed, so don't try to parse it. This is a fix for a bugreport where a Translation-en file contained the content of the regular Packages file (probably due to local FS corruption). This lead to strange error messages on file download. Thanks to Thomas Reusch for the report.
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debindexfile.cc2
-rw-r--r--apt-pkg/deb/deblistparser.h11
2 files changed, 12 insertions, 1 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index eee758b7a..a0dd15cd8 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -525,7 +525,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
if (FileExists(TranslationFile))
{
FileFd Trans(TranslationFile,FileFd::ReadOnly, FileFd::Extension);
- debListParser TransParser(&Trans);
+ debTranslationsParser TransParser(&Trans);
if (_error->PendingError() == true)
return false;
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index baace79fe..3b6963211 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -106,4 +106,15 @@ class debListParser : public pkgCacheGenerator::ListParser
APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
};
+class debTranslationsParser : public debListParser
+{
+ public:
+ // a translation can never be a real package
+ virtual std::string Architecture() { return ""; }
+ virtual std::string Version() { return ""; }
+
+ debTranslationsParser(FileFd *File, std::string const &Arch = "")
+ : debListParser(File, Arch) {};
+};
+
#endif