[Bug 277666] devel/uclcmd : uclcmd-0.2.20211204 get JSON and YAML output is broken

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 13 Mar 2024 11:59:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277666

            Bug ID: 277666
           Summary: devel/uclcmd : uclcmd-0.2.20211204 get JSON and YAML
                    output is broken
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: allanjude@FreeBSD.org
          Reporter: crest@rlwinm.de
          Assignee: allanjude@FreeBSD.org
             Flags: maintainer-feedback?(allanjude@FreeBSD.org)

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):
```


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.

-- 
You are receiving this mail because:
You are the assignee for the bug.