dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dmidecode --json


From: Erwan Velu
Subject: Re: dmidecode --json
Date: Mon, 3 Jul 2023 18:57:11 +0200

Hey,
first of all, I like the idea and it could be super helpful as we are
many to parse dmidecode output as text which isn't really good.

I tried your PR, here come my feedback :

1/ you are using iterators defined in loops which breaks the
compilation on older GCC compilers like the 4.8 on Rhel 7.
It would be cool to keep it compatible with older compilers so anyone
can use this feature
There are several build failures as per the following :

dmioutput.c:215:13: error: 'for' loop initial declarations are only
allowed in C99 mode
             for (int i = 0; key[i]; i++) {

2/ when specifying a given type, all other types are reported empty
like when calling "dmidecode -t 17 --json"
It would be cool not to print empty data structures

3/ the nasted hashes make it a bit complicated to manipulate with jq :
I tried to extract some values from matching a particular type, that's
not trivial

4/ be careful of the code indent in your PR, you're breaking the coding style


Le lun. 3 juil. 2023 à 18:19, Jiri Hnidek <jhnidek@redhat.com> a écrit :
>
> Hi All,
> I created another PR https://github.com/jirihnidek/dmidecode/pull/2, where
> "dmidecode --json" uses json-c. It is still draft. I need to do some
> refactoring and testing. Do not expect that it will work seamlessly with
> all combinations of CLI options.
>
> Example of output is here:
> https://gist.github.com/jirihnidek/2269d97f9cc9be9dc74b310eceb9e2d0
>
> I would like to get your feedback.
>
> I hope that such will be accepted (after addressing all requests and
> comments). We would not like to create some fork of dmidecode. Having the
> option to do output of dmidecode without any other wrapper like (
> https://kellyjonbrazil.github.io/jc/) is important to us.
>
> Thanks in advance,
>
> Jiri
>
> On Fri, Jun 23, 2023 at 4:45 PM Jiri Hnidek <jhnidek@redhat.com> wrote:
>
> > Hi,
> > I'm working on machine readable output of dmidecode. I added the --json
> > CLI option. You can see my POC here:
> >
> > https://github.com/jirihnidek/dmidecode/pull/1
> >
> > Example of output can be seen here:
> >
> > https://gist.github.com/jirihnidek/02c7620a5c2cf06752ccea877b35cc84
> >
> > As you can see there are no dependencies to any other library, but some
> > information is missing in the output (e.g. handle, DMI type), and there are
> > other issues.
> >
> > I would like to ask if you would be interested adding this to upstream
> > version of dmidecode?
> >
> > I would like to do proper implementation using the json-c library:
> > https://github.com/json-c/json-c This is a small library that is part of
> > most Linux distributions. Could adding dependency on json-c be acceptable?
> >
> > Adding support for machine readable output to dmidecode would be much
> > appreciated, because our tools like subscription-manager [1] (core part of
> > all RHEL) has to parse human readable output of dmidecode and it is
> > sub-optimal. There are other projects trying to parse output of dmidecode,
> > e.g. py-dmidecode: https://pypi.org/project/py-dmidecode/
> >
> > Thanks in advance
> >
> > Jiri
> >
> > [1] https://github.com/candlepin/subscription-manager/
> >
> > --
> > Jiri Hnidek
> > Senior Software Engineer, Team Candlepin, Red Hat
> >



reply via email to

[Prev in Thread] Current Thread [Next in Thread]