summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2024-01-23 13:45:46 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2024-03-07 15:35:17 +0000
commit3d1614b0a6c9c185ed1b2834e338f14d4de5b124 (patch)
tree0a0c2cdf0e7f95372d325399d150637496152564
parent14a69a43ebda520e9e51d067f40fd4d80a0f46f6 (diff)
Parse unsupported != relation in dependencies
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.
-rw-r--r--apt-pkg/deb/deblistparser.cc12
1 files changed, 11 insertions, 1 deletions
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;