Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634730

Re: [PATCH 2/7] perf config: Check list empty before showing configs

From Taeung Song <treeze.taeung@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/7] perf config: Check list empty before showing configs
Date 2017-05-03 06:10 +0200
Message-ID <tCTLX-80o-1@gated-at.bofh.it> (permalink)
References <tAueZ-2dU-3@gated-at.bofh.it> <tAuf0-2dU-21@gated-at.bofh.it> <tCHKN-8mq-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Arnaldo,

On 05/03/2017 12:12 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 26, 2017 at 09:21:03PM +0900, Taeung Song escreveu:
>> If existent config files contains nothing,
>> the sections list in config_set can be empty.
>>
>> So check not only NULL pointer of config_set but
>> also the list in config_set.
> <SNIP>
>> +++ b/tools/perf/builtin-config.c
>> @@ -75,7 +75,7 @@ static int show_spec_config(struct perf_config_set *set, const char *var)
>>  	struct perf_config_section *section;
>>  	struct perf_config_item *item;
>>
>> -	if (set == NULL)
>> +	if (set == NULL || list_empty(&set->sections))
>>  		return -1;
>
> But should we consider an error to have an empty config file? I don't
> think so :-\
>
> - Arnaldo

I think if we do, when a config file is not only not exist but also empty,
user can see the error message
(e.g. "Nothing configured, please check your ~/.perfconfig").
And IMHO, it seems better.

But if you don't think so, I got it.

Thanks,
Taeung

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] perf config: Bugfixes & Refactoring Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
  [PATCH 3/7] perf config: Use none_err for all cases that nothing configured Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
  [PATCH 4/7] perf config: Invert if statements to reduce nesting in cmd_config() Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
  [PATCH 2/7] perf config: Check list empty before showing configs Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
    Re: [PATCH 2/7] perf config: Check list empty before showing configs Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-05-02 17:20 +0200
      Re: [PATCH 2/7] perf config: Check list empty before showing configs Taeung Song <treeze.taeung@gmail.com> - 2017-05-03 06:10 +0200
  [PATCH 6/7] perf config: Finally write changed configs on config file at a time Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
  [PATCH 5/7] perf config: Correctly check whether it is from system config Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
  [PATCH 1/7] perf config: Refactor a duplicated code for config file name Taeung Song <treeze.taeung@gmail.com> - 2017-04-26 14:30 +0200
    [tip:perf/urgent] perf config: Refactor a duplicated code for  obtaining config file name tip-bot for Taeung Song <tipbot@zytor.com> - 2017-05-03 19:50 +0200

csiph-web