aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-11-29 17:47:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-12-08 11:17:09 +0300
commit9bc4fffd86e245e748589fdb601a944e466e405e (patch)
tree52894669b70296bb9ca976d6018c223cd57f626c
parent3419b77efca19b206f21d6fe23006b4227933641 (diff)
Fix pkg-build crash for system package specified with version constraint except for '/<version>' notation
-rw-r--r--bpkg/manifest-utility.cxx12
1 files 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 (