From 5caf6ee2db1ebf294fb0412fddf7d187840cce70 Mon Sep 17 00:00:00 2001 From: Apollon Oikonomopoulos Date: Wed, 12 Jul 2017 10:41:58 +0300 Subject: Handle supported components with slashes in sources.list Commit d7c92411dc1f4c6be098d1425f9c1c075e0c2154 parses the Components section of (In)Release and attempts to detect the distribution's supported components. While doing so, it handles component names with slashes in a special manner, assuming that the actual component is only the part after the final slash. This is done to handle security.debian.org, which usually appears in sources.list as follows: deb http://s.d.o/debian-security stretch/updates main contrib non-free while the actual release file has: Codename: stretch Components: updates/main updates/contrib updates/non-free While this special handing on APTs part indeed works for debian-security, it emits spurious warnings on repositories that actually use slashes in the component names *and* appear so in sources.list. We fix this by adding both component versions (whole and final part) to the SupportedComponents array. Closes: #868127 --- apt-pkg/deb/debmetaindex.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg/deb/debmetaindex.cc') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index df7419ddd..d7c458e66 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -414,10 +414,9 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro if (comp.empty()) continue; auto const pos = comp.find_last_of('/'); - if (pos == std::string::npos) - d->SupportedComponents.push_back(std::move(comp)); - else // e.g. security.debian.org uses this style + if (pos != std::string::npos) // e.g. security.debian.org uses this style d->SupportedComponents.push_back(comp.substr(pos + 1)); + d->SupportedComponents.push_back(std::move(comp)); } { decltype(pkgCache::ReleaseFile::Flags) flags = 0; -- cgit v1.2.3