diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-09-02T09·21+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-09-02T09·21+0000 |
commit | 7933cdc6dcbc5e6bc64e38c986b952e5ecd2dfa1 (patch) | |
tree | 7d1f17a7cbc071a407dbee003208964728134f56 /src/nix-env | |
parent | 0f0dbe8c0c958f14461ad998c0847a06f95eca1d (diff) |
* When writing the user environment manifest, filter out non-string
attributes from the meta attribute. Not doing so caused nix-env to barf on the "psi" package, which has a meta.function attribute, the textual serialisation of which causes a gigantic string to be produced --- so big that it causes nix-env to run out of memory. Note however that "meta" really only should contain strings. meta.function should be passthru.function.
Diffstat (limited to 'src/nix-env')
-rw-r--r-- | src/nix-env/nix-env.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index c67c940d5cd5..a7fc15904435 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -284,8 +284,14 @@ static bool createUserEnv(EvalState & state, const DrvInfos & elems, output path, and optionally the derivation path, as well as the meta attributes. */ Path drvPath = keepDerivations ? i->queryDrvPath(state) : ""; + + MetaInfo meta = i->queryMetaInfo(state); + ATermList metaList = ATempty; + foreach (MetaInfo::iterator, j, meta) + metaList = ATinsert(metaList, + makeBind(toATerm(j->first), makeStr(j->second), makeNoPos())); - ATermList as = ATmakeList4( + ATermList as = ATmakeList5( makeBind(toATerm("type"), makeStr("derivation"), makeNoPos()), makeBind(toATerm("name"), @@ -293,17 +299,13 @@ static bool createUserEnv(EvalState & state, const DrvInfos & elems, makeBind(toATerm("system"), makeStr(i->system), makeNoPos()), makeBind(toATerm("outPath"), - makeStr(i->queryOutPath(state)), makeNoPos())); + makeStr(i->queryOutPath(state)), makeNoPos()), + makeBind(toATerm("meta"), makeAttrs(metaList), makeNoPos())); if (drvPath != "") as = ATinsert(as, makeBind(toATerm("drvPath"), makeStr(drvPath), makeNoPos())); - if (i->attrs->get(toATerm("meta"))) as = ATinsert(as, - makeBind(toATerm("meta"), - strictEvalExpr(state, i->attrs->get(toATerm("meta"))), - makeNoPos())); - manifest = ATinsert(manifest, makeAttrs(as)); inputs = ATinsert(inputs, makeStr(i->queryOutPath(state))); |