1
1
Fork 0
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:
Jörg Thalheim 2025-11-30 14:24:12 +01:00
parent 98c7ca2c9f
commit ee5860f542

View file

@ -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)