Просмотр исходного кода

use consistently the last : as name:arch separator

Proper debian packages do not contain ':' in the package name, so for
real packages this is a non-issue, but apt itself frequently makes use
of packages with such an illegal name for internal proposes.

Git-Dch: Ignore
David Kalnischkies лет назад: 10
Родитель
Сommit
074564d40c
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      apt-pkg/pkgcache.cc
  2. 1 1
      apt-pkg/pkgcachegen.cc

+ 1 - 1
apt-pkg/pkgcache.cc

@@ -263,7 +263,7 @@ pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
 }
 }
 
 
 pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
 pkgCache::PkgIterator pkgCache::FindPkg(StringView Name) {
-	auto const found = Name.find(':');
+	auto const found = Name.rfind(':');
 	if (found == string::npos)
 	if (found == string::npos)
 	   return FindPkg(Name, "native");
 	   return FindPkg(Name, "native");
 	auto const Arch = Name.substr(found+1);
 	auto const Arch = Name.substr(found+1);

+ 1 - 1
apt-pkg/pkgcachegen.cc

@@ -659,7 +659,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg, StringView Name,
    // lazy-create foo (of amd64) provides foo:amd64 at the time we first need it
    // lazy-create foo (of amd64) provides foo:amd64 at the time we first need it
    if (Arch == "any")
    if (Arch == "any")
    {
    {
-      size_t const found = Name.find(':');
+      size_t const found = Name.rfind(':');
       StringView ArchA = Name.substr(found + 1);
       StringView ArchA = Name.substr(found + 1);
       if (ArchA != "any")
       if (ArchA != "any")
       {
       {