From efece35aa05ef7f89e3deb0c0017687ddd960af0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 6 Jun 2019 23:37:23 +0300 Subject: Fix uncaught invalid_argument thrown by pkg-build for package like 'foo/1.0.0-' --- bpkg/manifest-utility.cxx | 13 +++++++++++-- bpkg/pkg-build.cxx | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'bpkg') diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 8ff2090..74daf6b 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -82,11 +82,20 @@ namespace bpkg try { - return version (p); + version r (p); + + if (r.release && r.release->empty ()) + throw invalid_argument ("earliest version"); + + if (r.compare (wildcard_version, true /* ignore_revision */) == 0) + throw invalid_argument ("stub version"); + + return r; } catch (const invalid_argument& e) { - fail << "invalid package version '" << p << "': " << e; + fail << "invalid package version '" << p << "' in '" << s << "': " + << e; } } diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 590dbe9..0844ae9 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1777,7 +1777,7 @@ namespace bpkg return dependency_constraint ("~" + vs); } // Note that the only possible reason for invalid_argument exception to - // be thrown is that minor version reached the 999 limit (see + // be thrown is that minor version reached the 99999 limit (see // standard-version.cxx for details). // catch (const invalid_argument&) -- cgit v1.1