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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090710091445.GC27445@elte.hu>
Date:	Fri, 10 Jul 2009 11:14:45 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Erdem Aktas <eaktas1@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: [patch] perf_counter : breaking parameter parsing when the
	command is reached


* Erdem Aktas <eaktas1@...il.com> wrote:

>     Once the perf parameter parser reaches a non-parameter word, that means
>     the command is already found and the rest of the string is the parameter
>     of this command so no need to parse more.
> 
>     As an example, when we want to run
>     perf stat -- ls -al
>     it is obvious that the -al is the parameter of the ls command, so we
>     should able to run this like
>     perf stat ls -al
> 
>     Signed-off-by: eaktas <eaktas1@...il.com>
> 
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index 1bf6719..4ad4962 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -284,6 +284,11 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
>  			if (ctx->flags & PARSE_OPT_STOP_AT_NON_OPTION)
>  				break;
>  			ctx->out[ctx->cpidx++] = ctx->argv[0];
> +			while (--(ctx->argc)) {
> +				ctx->argv++;
> +				ctx->out[ctx->cpidx++] = ctx->argv[0];
> +			}
> +			ctx->argc++;

I think there might be a simpler solution: pass in 
PARSE_OPT_STOP_AT_NON_OPTION.

Then we'll trigger this existing code in parse_options_end():

        memmove(ctx->out + ctx->cpidx, ctx->argv, ctx->argc * sizeof(*ctx->out));
        ctx->out[ctx->cpidx + ctx->argc] = NULL;
        return ctx->cpidx + ctx->argc;

which should solve the issue just as well, correct?

	Ingo
--
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