From: David Sterba <dsterba@suse.cz>
To: Sidong Yang <realwakka@gmail.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs-progs: device stats: add json output format
Date: Wed, 16 Dec 2020 18:23:50 +0100 [thread overview]
Message-ID: <20201216172349.GJ6430@twin.jikos.cz> (raw)
In-Reply-To: <20201211180911.GB456927@realwakka>
On Fri, Dec 11, 2020 at 06:09:11PM +0000, Sidong Yang wrote:
> On Fri, Dec 11, 2020 at 06:46:29PM +0100, David Sterba wrote:
> > On Fri, Dec 11, 2020 at 06:30:25PM +0100, David Sterba wrote:
> > > On Fri, Dec 11, 2020 at 04:48:12PM +0000, Sidong Yang wrote:
> > > > Example json format:
> > > >
> > > > {
> > > > "__header": {
> > > > "version": "1"
> > > > },
> > > > "device-stats": [
> > > > {
> > > > "device": "/dev/vdb",
> > > > "devid": "1",
> > > > "write_io_errs": "0",
> > > > "read_io_errs": "0",
> > > > "flush_io_errs": "0",
> > > > "corruption_errs": "0",
> > > > "generation_errs": "0"
> > > > }
> > > > ],
> > > ^
> > >
> > > I've verified that the comma is really there, it's not a valid json so
> > > there's a bug in the formatter. To verify that the output is valid you
> > > can use eg. 'jq', simply pipe the output of the commadn there.
> > >
> > > $ ./btrfs --format json dev stats /mnt | jq
> > > parse error: Expected another key-value pair at line 16, column 1
> >
> > I've pushed the updated plain text formatting to devel, so the only
> > remaining bug is the above extra comma.
>
> I've tested devel branch. but there is no extra comma and I also tested
> with jq you said. jq results no error. I think that It's just mistype in
> message.
That's strange because the formatter is buggy, eg. the simplest
fmt_start()/fmt_end() leads to
$ ./json-formatter-test
{
"__header": {
"version": "1"
},
}
---
Which is of course invalid and jq confirms that.
next prev parent reply other threads:[~2020-12-16 17:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 16:48 [PATCH v3 1/2] btrfs-progs: common: extend fmt_print_start_group handles unnamed group Sidong Yang
2020-12-11 16:48 ` [PATCH v3 2/2] btrfs-progs: device stats: add json output format Sidong Yang
2020-12-11 17:30 ` David Sterba
2020-12-11 17:46 ` David Sterba
2020-12-11 18:09 ` Sidong Yang
2020-12-16 17:23 ` David Sterba [this message]
2020-12-16 17:41 ` David Sterba
2020-12-16 6:30 ` Su Yue
2020-12-16 10:52 ` Sidong Yang
2020-12-16 12:52 ` Su Yue
2020-12-16 17:21 ` David Sterba
2020-12-16 17:18 ` David Sterba
2020-12-11 17:31 ` [PATCH v3 1/2] btrfs-progs: common: extend fmt_print_start_group handles unnamed group David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201216172349.GJ6430@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=realwakka@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox