From 3d1614b0a6c9c185ed1b2834e338f14d4de5b124 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 23 Jan 2024 13:45:46 +0000 Subject: Parse unsupported != relation in dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libapt has a NotEquals relation for version constraints in dependencies, which is used internally e.g. in the MultiArch implementation, but this relation is not supported by Debian policy and as such can not be used in packages. Our parser here is extremely accepting, even unknown relations are parsed as Equals relation – but the version that must match will be a rather strange one… For our own testcases and e.g. on the command line with 'satisfy' it can make sense to have != available… and what strange things apt does parsing unsupported relations is not really much of a concern. Real packages will not have such relations anyhow as we are (mostly) just a consumer, not a producer of packages and index files. --- apt-pkg/deb/deblistparser.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 8099b36e4..46c362952 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -522,7 +522,17 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) Op = pkgCache::Dep::Equals; I++; break; - + + // != is unsupported packaging + case '!': + if (*(I + 1) == '=') + { + I = I + 2; + Op = pkgCache::Dep::NotEquals; + break; + } + [[fallthrough]]; + // HACK around bad package definitions default: Op = pkgCache::Dep::Equals; -- cgit v1.2.3-70-g09d2