1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

DerivationBuilder: Fix compiler warning

Fixes

  ../src/libstore/unix/build/derivation-builder.cc:1130:86: warning: the compiler can assume that the address of ‘nix::DerivationBuilderParams::drv’ will never be NULL [-Waddress]
   1130 |     if (useChroot && settings.preBuildHook != "" && dynamic_cast<const Derivation *>(&drv)) {
        |                                                                                        ^~~~

Assuming this check was left over from the time `drv` could be a
`BasicDerivation`.
This commit is contained in:
Eelco Dolstra 2025-04-23 17:28:09 +02:00
parent 876f676d90
commit d07541be29

View file

@ -1127,7 +1127,7 @@ void DerivationBuilderImpl::startBuilder()
if (needsHashRewrite() && pathExists(homeDir)) if (needsHashRewrite() && pathExists(homeDir))
throw Error("home directory '%1%' exists; please remove it to assure purity of builds without sandboxing", homeDir); throw Error("home directory '%1%' exists; please remove it to assure purity of builds without sandboxing", homeDir);
if (useChroot && settings.preBuildHook != "" && dynamic_cast<const Derivation *>(&drv)) { if (useChroot && settings.preBuildHook != "") {
printMsg(lvlChatty, "executing pre-build hook '%1%'", settings.preBuildHook); printMsg(lvlChatty, "executing pre-build hook '%1%'", settings.preBuildHook);
auto args = useChroot ? Strings({store.printStorePath(drvPath), chrootRootDir}) : auto args = useChroot ? Strings({store.printStorePath(drvPath), chrootRootDir}) :
Strings({ store.printStorePath(drvPath) }); Strings({ store.printStorePath(drvPath) });