Merge pull request #10666 from tie/derivation-outputs-drv-path

Forbid drvPath in strictDerivation outputs attribute
This commit is contained in:
Robert Hensing
2024-05-12 21:14:32 +02:00
committed by GitHub
2 changed files with 145 additions and 65 deletions

View File

@@ -1184,11 +1184,11 @@ static void derivationStrictInternal(
.debugThrow();
/* !!! Check whether j is a valid attribute
name. */
/* Derivations cannot be named drv, because
then we'd have an attribute drvPath in
the resulting set. */
if (j == "drv")
state.error<EvalError>("invalid derivation output name 'drv'")
/* Derivations cannot be named drvPath, because
we already have an attribute drvPath in
the resulting set (see state.sDrvPath). */
if (j == "drvPath")
state.error<EvalError>("invalid derivation output name 'drvPath'")
.atPos(v)
.debugThrow();
outputs.insert(j);