* 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.
This commit is contained in:
Eelco Dolstra 2008-09-02 09:21:38 +00:00
parent 0f0dbe8c0c
commit 7933cdc6dc

View file

@ -285,7 +285,13 @@ static bool createUserEnv(EvalState & state, const DrvInfos & elems,
the meta attributes. */ the meta attributes. */
Path drvPath = keepDerivations ? i->queryDrvPath(state) : ""; Path drvPath = keepDerivations ? i->queryDrvPath(state) : "";
ATermList as = ATmakeList4( 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 = ATmakeList5(
makeBind(toATerm("type"), makeBind(toATerm("type"),
makeStr("derivation"), makeNoPos()), makeStr("derivation"), makeNoPos()),
makeBind(toATerm("name"), makeBind(toATerm("name"),
@ -293,17 +299,13 @@ static bool createUserEnv(EvalState & state, const DrvInfos & elems,
makeBind(toATerm("system"), makeBind(toATerm("system"),
makeStr(i->system), makeNoPos()), makeStr(i->system), makeNoPos()),
makeBind(toATerm("outPath"), makeBind(toATerm("outPath"),
makeStr(i->queryOutPath(state)), makeNoPos())); makeStr(i->queryOutPath(state)), makeNoPos()),
makeBind(toATerm("meta"), makeAttrs(metaList), makeNoPos()));
if (drvPath != "") as = ATinsert(as, if (drvPath != "") as = ATinsert(as,
makeBind(toATerm("drvPath"), makeBind(toATerm("drvPath"),
makeStr(drvPath), makeNoPos())); 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)); manifest = ATinsert(manifest, makeAttrs(as));
inputs = ATinsert(inputs, makeStr(i->queryOutPath(state))); inputs = ATinsert(inputs, makeStr(i->queryOutPath(state)));