Bug 277666 - devel/uclcmd : uclcmd-0.2.20211204 get JSON and YAML output is broken.
The JSON and YAML output from uclcmd is invalid. Here is simple reproducer to show the result:
uclcmd get --json . <<EOF
foo [{bar: baz}]
EOF
The incorrect output is:
,
{
,
"foo": [
,
{
"bar": "baz"
}
]
}
The correct output would be:
{
"foo": [
{
"bar": "baz"
}
]
}
The YAML output is similarly broken, but it's partially hidden the more flexible syntax where the fields of an object are separated only by whitespaces instead of comma, newline and indentation.
The wrong YAML output (notice the extra newlines):
# Comment added to preserve both leading newlines in GitHub Markdown code block rendering.
foo: [
,
{
bar: "baz"
}
]
The correct YAML output would be:
foo: [
{
bar: "baz"
}
]
It's possible the bug isn't directly in uclcmd-0.2.20211204 and that uclcmd only exposes a bug in libucl-0.9.0. As it is right now uclcmd can't be used to extract any values containing arrays or objects in JSON or YAML format. The UCL formatted output works is syntactically valid and correctly represents the emitted data. The tests were performed on FreeBSD 14.0p5/amd64 with the libucl and uclcmd installed from the latest branch of the official package repos.
This GitHub issue is a forwarded copy of the FreeBSD PR #277666. Sorry for reaching out via multiple channels at once.