Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 277666 - devel/uclcmd : uclcmd-0.2.20211204 get JSON and YAML output is broken. #30

Open
Crest opened this issue Mar 14, 2024 · 0 comments

Comments

@Crest
Copy link

Crest commented Mar 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant