[Nix-dev] [***SPAM***] ‘nix-instantiate --xml’ and self-referential attrsets
Ludovic Courtès
ludo at gnu.org
Sat Apr 9 17:29:41 CEST 2011
Hello!
Consider this example:
--8<---------------cut here---------------start------------->8---
let x = derivation {
name = "x"; builder = ./foo.sh; system = builtins.currentSystem;
};
y = { b = x; };
in
x // y
--8<---------------cut here---------------end--------------->8---
Running ‘nix-instantiate --strict --eval-only --xml’ yields this:
--8<---------------cut here---------------start------------->8---
<?xml version='1.0' encoding='utf-8'?>
<expr>
<derivation drvPath="/nix/store/b1pmg2fhxnlnxy0z9hfglgyk66wpa2ar-x.drv" outPath="/nix/store/fw6flnp42lqn9i62aknpch29sadds5pi-x">
<attr column="11" line="2" name="b" path="/home/ludo/src/nixpkgs/maintainers/scripts/gnu/self-ref.nix">
<derivation drvPath="/nix/store/b1pmg2fhxnlnxy0z9hfglgyk66wpa2ar-x.drv" outPath="/nix/store/fw6flnp42lqn9i62aknpch29sadds5pi-x">
<repeated />
</derivation>
</attr>
[...]
</derivation>
</expr>
--8<---------------cut here---------------end--------------->8---
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.
I believe this patch fixes it:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 547 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20110409/8dd4001d/attachment.bin
-------------- next part --------------
OK to apply, along with a test?
(For the record, I just encountered this problem for the first time with
‘buildInternalPythonModule’ in the Python 2.7 expression.)
Thanks,
Ludo’.
More information about the nix-dev
mailing list