mirror of
https://github.com/NixOS/nix.git
synced 2025-12-04 16:10:59 +01:00
Fix crash when querying realisations without ca-derivations enabled
queryRealisationUncached was crashing with an assertion failure when ca-derivations experimental feature is not enabled, because the SQLite statements for realisations are only initialized when ca-derivations is enabled. Return nullptr (no realisation found) when ca-derivations is disabled, matching the behavior of other CA-related functions like registerDrvOutput which check for the feature before proceeding.
This commit is contained in:
parent
98c7ca2c9f
commit
ee5860f542
1 changed files with 4 additions and 0 deletions
|
|
@ -1634,6 +1634,10 @@ void LocalStore::queryRealisationUncached(
|
||||||
const DrvOutput & id, Callback<std::shared_ptr<const UnkeyedRealisation>> callback) noexcept
|
const DrvOutput & id, Callback<std::shared_ptr<const UnkeyedRealisation>> callback) noexcept
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
if (!experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
|
||||||
|
callback(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto maybeRealisation = retrySQLite<std::optional<const UnkeyedRealisation>>(
|
auto maybeRealisation = retrySQLite<std::optional<const UnkeyedRealisation>>(
|
||||||
[&]() { return queryRealisation_(*_state->lock(), id); });
|
[&]() { return queryRealisation_(*_state->lock(), id); });
|
||||||
if (maybeRealisation)
|
if (maybeRealisation)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue