From 9bc4fffd86e245e748589fdb601a944e466e405e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 29 Nov 2023 17:47:30 +0300 Subject: Fix pkg-build crash for system package specified with version constraint except for '/' notation --- bpkg/manifest-utility.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 76db3a7..b0b599b 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -133,12 +133,16 @@ namespace bpkg if (s[n] == '\0') // No version (constraint) is specified? return nullopt; - const char* v (s + n); // Constraint or version including '/'. + const char* v (s + n); // Constraint or version including leading '/'. - // If only the version is allowed or the package name is followed by '/' - // then fallback to the version parsing. + if (version_only && v[0] != '/') + fail << "exact package version expected instead of version constraint " + << "in '" << s << "'"; + + // If the package name is followed by '/' then fallback to the version + // parsing. // - if (version_only || v[0] == '/') + if (v[0] == '/') try { return version_constraint ( -- cgit v1.1