aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-06-29 20:15:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-06-29 20:15:42 +0300
commitab1be40924c6bac764f31cfd665e5041530c0a02 (patch)
tree4f5ee5611519c82cfa94fa2157397d92669a2661
parent6de7f99a62a353e0f5c36ebddfe8c9f6ded1d7b0 (diff)
Fix assertion failure in package_skeleton::reload_defaults()
-rw-r--r--bpkg/pkg-build-collect.cxx28
1 files changed, 24 insertions, 4 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx
index 036e5b6..9d4c17a 100644
--- a/bpkg/pkg-build-collect.cxx
+++ b/bpkg/pkg-build-collect.cxx
@@ -3353,7 +3353,8 @@ namespace bpkg
// then we wouldn't be able to continue using it if
// negotiate_configuration() below returns false. So it seems
// the most sensible approach is to make a temporary copy and
- // reset that.
+ // reset that (see the similar code in
+ // collect_build_postponed()).
//
small_vector<reference_wrapper<package_skeleton>, 1> depcs;
forward_list<package_skeleton> depcs_storage; // Ref stability.
@@ -4802,8 +4803,15 @@ namespace bpkg
dept = &*b->skeleton;
}
+ // If a dependency has already been recursively collected, then we can
+ // no longer call reload_defaults() or verify_sensible() on its
+ // skeleton. Thus, we make a temporary copy and reset that (see the
+ // collect() lambda in collect_build_prerequisites() for more
+ // details).
+ //
pair<size_t, size_t> pos;
small_vector<reference_wrapper<package_skeleton>, 1> depcs;
+ forward_list<package_skeleton> depcs_storage; // Ref stability.
bool has_alt;
{
// A non-negotiated cluster must only have one depends position for
@@ -4830,9 +4838,21 @@ namespace bpkg
build_package* b (entered_build (pk));
assert (b != nullptr);
- depcs.push_back (b->skeleton
- ? *b->skeleton
- : b->init_skeleton (o /* options */));
+ package_skeleton* depc;
+ if (b->recursive_collection)
+ {
+ assert (b->skeleton);
+
+ depcs_storage.push_front (*b->skeleton);
+ depc = &depcs_storage.front ();
+ depc->reset ();
+ }
+ else
+ depc = &(b->skeleton
+ ? *b->skeleton
+ : b->init_skeleton (o /* options */));
+
+ depcs.push_back (*depc);
}
}