Subject: Re: [PATCH iproute2-next] ip: Use single variable to represent -pretty

From: Stephen Hemminger <[email-masked]>
Date: Thu, 15 Feb 2018 10:58:15 -0800

On Thu, 15 Feb 2018 20:31:33 +0200
Serhey Popovych <[email-masked]> wrote:

> After commit a233caa0aaee ("json: make pretty printing optional") I get
> following build failure:
> 
>     LINK     rtmon
>     ../lib/libutil.a(json_print.o): In function `new_json_obj':
>     json_print.c:(.text+0x35): undefined reference to `show_pretty'
>     collect2: error: ld returned 1 exit status
>     make[1]: *** [rtmon] Error 1
>     make: *** [all] Error 2
> 
> It is caused by missing show_pretty variable in rtmon.
> 
> On the other hand tc/tc.c there are two distinct variables and single
> matches() call that handles -pretty option thus setting show_pretty
> will never happen. Note that since commit 44dcfe820185 ("Change
> formatting of u32 back to default") show_pretty is used in tc/f_u32.c
> so this is first place where -pretty introduced.
> 
> Furthermore other utilities like misc/ifstat.c and misc/nstat.c define
> pretty variable, however only for their own purposes. They both support
> JSON output and thus depend show_pretty in new_json_obj().
> 
> Assuming above use common variable to represent -pretty option, define
> it in utils.c and declare in utils.h that is commonly used. Replace
> show_pretty with pretty.
> 
> Fixes: a233caa0aaee ("json: make pretty printing optional")
> Signed-off-by: Serhey Popovych <[email-masked]>
> ---

Looks Good to me.
Not sure it did not show up in my builds.

I am fixing bridge to use similar json/color/pretty flags.