Re: [PATCH] perf-script : improves option passing mechansim

From: Arnaldo Carvalho de Melo
Date: Thu Mar 20 2014 - 15:32:39 EST


Em Thu, Mar 20, 2014 at 02:52:30PM +0100, Adrien BAK escreveu:
> Indeed. I wasn't aware of the '--' behaviour and the documentation
> doesn't seem to mention it. My patch essentially implements the same
> behaviour, except that the script name itself is used to separate
> the options. I guess there is not much need the proposed patch then.
>
> Sorry for the wasted time.

No need to be sorry, I appreciate _you_ taking the time to help improve
the tools, maybe you can send a patch to update the documentation
instead, with examples where -- is used so that people don't fall into
this trap again?

Thanks!

- Arnaldo

> Adrien
>
> On 03/18/2014 07:15 PM, Arnaldo Carvalho de Melo wrote:
> >Em Tue, Mar 18, 2014 at 05:09:33PM +0100, Adrien BAK escreveu:
> >>This pull request fixes the following issues :
> >>* when passing custom arguments to a script, if those arguments are
> >> not declared within perf, they prevent the execution of perf.
> >>e.g.
> >>
> >>perf script -i path/to/perf.data -s my_script -arg1 arg_value
> >>
> >>perf will issue an error message and no processing will occur
> >I haven't tested this, but what comes to mind is the use of -- to
> >separate what options should be processed by perf and which ones should
> >be left to the script, is that what you're fixing?
> >
> >- Arnaldo
> >>* when passing custom arguments to a script, if those arguments are
> >> declared by perf, they are consumed and not passed to the script.
> >>e.g.
> >>perf script -i path/to/perf.data -s my_script -h
> >>
> >>perf will display its own help message, instead of the expected help
> >>message from my_script.
> >>
> >>These issues are addressed as follows :
> >>* The parse option flag is changed from PARSE_OPT_STOP_AT_NON_OPTION to
> >>PARSE_OPT_KEEP_UNKNOWN
> >>* A new option type is introduce OPT_CALLBACK_FINAL_OPTION, which
> >>effectively
> >> prevents the parsing of all options located after the script.
> >>
> >>Signed-off-by: Adrien Bak <adrien.bak@xxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/