summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-12-11 14:27:56 +0100
committerJulian Andres Klode <jak@debian.org>2015-12-11 14:48:21 +0100
commitfffa3b57b4f2334dff3b9bef5401521307e1a721 (patch)
tree646ce65c49af01fce0cefcf549705a46ad2405a9
parent03dfa26f2662c9a03e28270ae2378d6b93a5dc85 (diff)
Convert package names from Packages files to lower case
dpkg does that when reading package files, so we should do the same. This only deals with parsing names from binary package paragraphs, it does not look at source package names and/or the list of binaries in a dsc file. Closes: #807012
-rw-r--r--apt-pkg/deb/deblistparser.cc7
-rw-r--r--apt-pkg/deb/debrecords.cc8
-rwxr-xr-xtest/integration/test-bug-807012-mixed-case-package-names21
3 files changed, 34 insertions, 2 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 229cfc29b..bf9bc75ec 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -57,7 +57,12 @@ debListParser::debListParser(FileFd *File) :
// ---------------------------------------------------------------------
/* This is to return the name of the package this section describes */
string debListParser::Package() {
- string const Result = Section.FindS("Package");
+ string Result = Section.FindS("Package");
+
+ // Normalize mixed case package names to lower case, like dpkg does
+ // See Bug#807012 for details
+ std::transform(Result.begin(), Result.end(), Result.begin(), tolower_ascii);
+
if(unlikely(Result.empty() == true))
_error->Error("Encountered a section with no Package: header");
return Result;
diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc
index d78a7e2e0..beaa83bd9 100644
--- a/apt-pkg/deb/debrecords.cc
+++ b/apt-pkg/deb/debrecords.cc
@@ -65,7 +65,13 @@ string debRecordParserBase::FileName()
// RecordParserBase::Name - Return the package name /*{{{*/
string debRecordParserBase::Name()
{
- return Section.FindS("Package");
+ string Result = Section.FindS("Package");
+
+ // Normalize mixed case package names to lower case, like dpkg does
+ // See Bug#807012 for details
+ std::transform(Result.begin(), Result.end(), Result.begin(), tolower_ascii);
+
+ return Result;
}
/*}}}*/
// RecordParserBase::Homepage - Return the package homepage /*{{{*/
diff --git a/test/integration/test-bug-807012-mixed-case-package-names b/test/integration/test-bug-807012-mixed-case-package-names
new file mode 100755
index 000000000..65da7b146
--- /dev/null
+++ b/test/integration/test-bug-807012-mixed-case-package-names
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+TMPDIR=$(readlink -f .)
+
+insertinstalledpackage 'worldofgoo' 'all' '1'
+insertpackage 'unstable' 'WorldOfGoo' 'all' '1'
+
+setupaptarchive
+
+testsuccessequal "worldofgoo:
+ Installed: 1
+ Candidate: 1
+ Version table:
+ *** 1 500
+ 500 file:${TMPDIR}/aptarchive unstable/main all Packages
+ 100 ${TMPDIR}/rootdir/var/lib/dpkg/status" \
+ aptcache policy worldofgoo