lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciayaH4r9=WmXWWfjDbpPDhOgSwEzvba-M=fOWQreoeJw@mail.gmail.com>
Date:	Fri, 23 Oct 2015 00:58:53 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Borislav Petkov <bp@...e.de>,
	Brendan Gregg <brendan.d.gregg@...il.com>,
	Chandler Carruth <chandlerc@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH 1/2] perf tools: Setup pager when printing usage and help

On Thu, Oct 22, 2015 at 11:41 PM, Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
> Em Thu, Oct 22, 2015 at 11:28:31PM +0900, Namhyung Kim escreveu:
>> It's annoying to see error or help message when command has many options
>> like in perf record, report or top.  So setup pager when print parser
>> error or help message - it should be OK since no UI is enabled at the
>> parsing time.  The usage_with_options() already disables it by calling
>> exit_browser() anyway.
>
> But then we don't know what went wrong, try:
>
> [acme@zoo linux]$ perf record --all-cpus -g --42 --event cycles 2>&1 | head
>   Error: unknown option `42'
>
>  Usage: perf record [<options>] [<command>]
>     or: perf record [<options>] -- <command> [<options>]
>
>     -e, --event <event>   event selector. use 'perf list' to list
> available events
>         --filter <filter>
>                           event filter
>         --exclude-perf    don't record events from perf itself
>     -p, --pid <pid>       record events on existing process id
> [acme@zoo linux]$
>
> Without this patch I can see what was the option that caused the problem
> (--42 in this case), after the patch I can see only the valid options,
> not the one causing the problem, well, I can see it only if I use the
> same 2>&1 technique above.

Hmm.. some message are printed before calling usage_with_options() so
pager don't know about it.  Will check how to fix this..

Thanks,
Namhyung


>> Cc: Adrian Hunter <adrian.hunter@...el.com>
>> Cc: Borislav Petkov <bp@...e.de>
>> Cc: Brendan Gregg <brendan.d.gregg@...il.com>
>> Cc: Chandler Carruth <chandlerc@...il.com>
>> Cc: Frederic Weisbecker <fweisbec@...il.com>
>> Cc: Stephane Eranian <eranian@...gle.com>
>> Cc: Wang Nan <wangnan0@...wei.com>
>> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
>> ---
>>  tools/perf/util/parse-options.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
>> index 8aa7922397a9..388d385df5ad 100644
>> --- a/tools/perf/util/parse-options.c
>> +++ b/tools/perf/util/parse-options.c
>> @@ -648,6 +648,8 @@ int usage_with_options_internal(const char * const *usagestr,
>>       if (!usagestr)
>>               return PARSE_OPT_HELP;
>>
>> +     setup_pager();
>> +
>>       fprintf(stderr, "\n Usage: %s\n", *usagestr++);
>>       while (*usagestr && **usagestr)
>>               fprintf(stderr, "    or: %s\n", *usagestr++);
>> --
>> 2.6.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ