[Nix-dev] Re: ‘nix-instantiate --xml’ and self-referential attrsets

Eelco Dolstra e.dolstra at tudelft.nl
Sun Apr 10 20:45:11 CEST 2011


Hi,

On 04/09/2011 05:29 PM, Ludovic Courtès wrote:

> When parsing this with SAX, the ‘repeated’ element is seen before the
> first occurrence of the derivation, which is a problem: the program that
> parses it doesn’t have anything to repeat yet.

It depends on what you're trying to do in the SAX parser, but can't you 
just skip the "repeated" node?

> --- nix/src/libexpr/expr-to-xml.cc~	2010-05-31 12:59:38.000000000 +0200
> +++ nix/src/libexpr/expr-to-xml.cc	2011-04-09 17:23:26.000000000 +0200
> @@ -138,8 +138,8 @@ static void printTermAsXML(Expr e, XMLWr
>               XMLOpenElement _(doc, "derivation", xmlAttrs);

This patch is against a very out-dated source tree.  That file and 
function don't exist anymore.

>
>               if (drvsSeen.find(e) == drvsSeen.end()) {
> -                drvsSeen.insert(e);
>                   showAttrs(attrs, doc, context, drvsSeen, location);
> +                drvsSeen.insert(e);

Wouldn't this introduce a potential infinite recursion?  Also, wouldn't 
it cause the same derivation to be printed twice?

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list