Open ghost opened 3 months ago
For the record, the jsonnet
cli does not choke on these same inputs:
(env) [jsonnet-python-yaml]$ jsonnet test.jsonnet
{
"bar": "bar",
"foo": "bar"
}
Actually, this exact issue is present with pure libjsonnet:
#include <iostream>
extern "C" {
#include <libjsonnet.h>
}
int main(int argc, char** argv)
{
JsonnetVm *vm = jsonnet_make();
int error{};
char *result = jsonnet_evaluate_snippet(vm, "test.jsonnet", R"(
std.parseYaml(|||
foo: &foo bar
bar: *foo
|||)
)", &error);
if (error)
{
std::cerr << "Error: " << result << std::endl;
}
else
{
std::cout << result << std::endl;
}
jsonnet_realloc(vm, result, 0);
jsonnet_destroy(vm);
}
(env) [jsonnet-go-c]$ LD_LIBRARY_PATH=/home/benjamin.jackson/repos/github/google/jsonnet/build ./a.out
/home/benjamin.jackson/repos/github/google/jsonnet/third_party/rapidyaml/ryml_all.hpp:23120:JSON does not have anchors
Aborted (core dumped)
When using the python bindings (jsonnet-0.20.0), an abort is hit when using
std.parseYaml
with a file containing anchors.Steps to reproduce: using
jsonnet
import, simplystd.parseYaml
on any YAML containing anchors.Minimal example:
I can confirm this same abort when using
evaluate_file
tooEnv: