public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Irina Tirdea <irina.tirdea@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ingo Molnar <mingo@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	LKML <linux-kernel@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Pekka Enberg <penberg@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Irina Tirdea <irina.tirdea@intel.com>
Subject: Re: [PATCH 2/4] perf tools: configure shell path at compile time
Date: Thu, 20 Sep 2012 21:28:53 -0600	[thread overview]
Message-ID: <505BDEF5.205@gmail.com> (raw)
In-Reply-To: <1348179215-11160-3-git-send-email-irina.tirdea@gmail.com>

On 9/20/12 4:13 PM, Irina Tirdea wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
>
> Shell path /bin/sh is hardcoded in various places in perf. Android has a
> different folder structure and does not have /bin/sh.
>
> Set the shell path at compile time in the Makefile by setting PERF_SHELL_PATH.
> By default it is set to /bin/sh.

code change below uses PERF_SHELL_DIR; it's not a directory so 
PERF_SHELL_PATH per the above comment is better.

David


>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> ---
>   tools/perf/Makefile         |    6 +++++-
>   tools/perf/builtin-help.c   |    2 +-
>   tools/perf/builtin-script.c |   12 ++++++------
>   3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index eab4a36..9021a1f 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -828,7 +828,11 @@ $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFL
>   	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
>   		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
>   		'-DPERF_MAN_PATH="$(mandir_SQ)"' \
> -		'-DPERF_INFO_PATH="$(infodir_SQ)"' $<
> +		'-DPERF_INFO_PATH="$(infodir_SQ)"' \
> +		'-DPERF_SHELL_DIR="/bin/sh"' $<
> +
> +$(OUTPUT)builtin-script.o: builtin-script.c $(OUTPUT)PERF-CFLAGS
> +	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DPERF_SHELL_DIR='"/bin/sh"' $<
>
>   $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
>   	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
> diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
> index 25c8b94..a1d9703 100644
> --- a/tools/perf/builtin-help.c
> +++ b/tools/perf/builtin-help.c
> @@ -171,7 +171,7 @@ static void exec_man_cmd(const char *cmd, const char *page)
>   {
>   	struct strbuf shell_cmd = STRBUF_INIT;
>   	strbuf_addf(&shell_cmd, "%s %s", cmd, page);
> -	execl("/bin/sh", "sh", "-c", shell_cmd.buf, NULL);
> +	execl(PERF_SHELL_DIR, "sh", "-c", shell_cmd.buf, NULL);
>   	warning("failed to exec '%s': %s", cmd, strerror(errno));
>   }
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 1be843a..4cc2c96 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -1326,7 +1326,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   				goto out;
>   			}
>
> -			__argv[j++] = "/bin/sh";
> +			__argv[j++] = PERF_SHELL_DIR;
>   			__argv[j++] = rec_script_path;
>   			if (system_wide)
>   				__argv[j++] = "-a";
> @@ -1337,7 +1337,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   				__argv[j++] = argv[i];
>   			__argv[j++] = NULL;
>
> -			execvp("/bin/sh", (char **)__argv);
> +			execvp(PERF_SHELL_DIR, (char **)__argv);
>   			free(__argv);
>   			exit(-1);
>   		}
> @@ -1353,7 +1353,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   		}
>
>   		j = 0;
> -		__argv[j++] = "/bin/sh";
> +		__argv[j++] = PERF_SHELL_DIR;
>   		__argv[j++] = rep_script_path;
>   		for (i = 1; i < rep_args + 1; i++)
>   			__argv[j++] = argv[i];
> @@ -1361,7 +1361,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   		__argv[j++] = "-";
>   		__argv[j++] = NULL;
>
> -		execvp("/bin/sh", (char **)__argv);
> +		execvp(PERF_SHELL_DIR, (char **)__argv);
>   		free(__argv);
>   		exit(-1);
>   	}
> @@ -1390,7 +1390,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   			goto out;
>   		}
>
> -		__argv[j++] = "/bin/sh";
> +		__argv[j++] = PERF_SHELL_DIR;
>   		__argv[j++] = script_path;
>   		if (system_wide)
>   			__argv[j++] = "-a";
> @@ -1398,7 +1398,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
>   			__argv[j++] = argv[i];
>   		__argv[j++] = NULL;
>
> -		execvp("/bin/sh", (char **)__argv);
> +		execvp(PERF_SHELL_DIR, (char **)__argv);
>   		free(__argv);
>   		exit(-1);
>   	}
>


  reply	other threads:[~2012-09-21  3:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20 22:13 [PATCH 0/4] perf: android: configure hardcoded paths Irina Tirdea
2012-09-20 22:13 ` [PATCH 1/4] perf tools: configure tmp path at build time Irina Tirdea
2012-09-21  7:47   ` Pekka Enberg
2012-09-21 13:05     ` David Ahern
2012-09-20 22:13 ` [PATCH 2/4] perf tools: configure shell path at compile time Irina Tirdea
2012-09-21  3:28   ` David Ahern [this message]
2012-09-20 22:13 ` [PATCH 3/4] perf annotate: configure objdump " Irina Tirdea
2012-09-21  0:17   ` Namhyung Kim
2012-09-20 22:13 ` [PATCH 4/4] perf tools: configure addr2line " Irina Tirdea
2012-09-21  0:19   ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=505BDEF5.205@gmail.com \
    --to=dsahern@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=irina.tirdea@gmail.com \
    --cc=irina.tirdea@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox