From ab1be40924c6bac764f31cfd665e5041530c0a02 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 29 Jun 2023 20:15:42 +0300 Subject: Fix assertion failure in package_skeleton::reload_defaults() --- bpkg/pkg-build-collect.cxx | 28 ++++++++++++++++++++++++---- 1 file 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, 1> depcs; forward_list 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 pos; small_vector, 1> depcs; + forward_list 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); } } -- cgit v1.1