linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Minchan Kim <minchan@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH 1/2] perf tools: Ensure --symfs ends with '/'
Date: Tue, 29 Jul 2014 09:33:05 -0300	[thread overview]
Message-ID: <20140729123305.GO7831@kernel.org> (raw)
In-Reply-To: <20140729050246.GC22707@bbox>

Em Tue, Jul 29, 2014 at 02:02:46PM +0900, Minchan Kim escreveu:
> On Fri, Jul 25, 2014 at 10:31:47AM +0900, Namhyung Kim wrote:
> > Minchan reported that perf failed to load vmlinux if --symfs argument
> > doesn't end with '/' character.  So make sure that the symfs always
> > ends with the '/'.
> > 
> > Reported-by: Minchan Kim <minchan@kernel.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Both patches work and are handy to me.
> Thanks Namhyung.

I haven't said it is not :-) Just that it should be fixed in a different
way.

Can you please try the patch below instead?

David, was there any reason not to do it like done in this patch?

- Arnaldo

---
 annotate.c |    4 ++--
 dso.c      |    8 ++++----
 symbol.c   |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 809b4c50beae..e67ef4a2b356 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -900,7 +900,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
 	bool delete_extract = false;
 
 	if (filename) {
-		snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
+		snprintf(symfs_filename, sizeof(symfs_filename), "%s/%s",
 			 symbol_conf.symfs, filename);
 	}
 
@@ -922,7 +922,7 @@ fallback:
 		 * DSO is the same as when 'perf record' ran.
 		 */
 		filename = (char *)dso->long_name;
-		snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
+		snprintf(symfs_filename, sizeof(symfs_filename), "%s/%s",
 			 symbol_conf.symfs, filename);
 		free_filename = false;
 	}
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 90d02c661dd4..f81550583429 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -79,7 +79,7 @@ int dso__read_binary_type_filename(const struct dso *dso,
 		while (last_slash != dso->long_name && *last_slash != '/')
 			last_slash--;
 
-		len = scnprintf(filename, size, "%s", symbol_conf.symfs);
+		len = scnprintf(filename, size, "%s/", symbol_conf.symfs);
 		dir_size = last_slash - dso->long_name + 2;
 		if (dir_size > (size - len)) {
 			ret = -1;
@@ -108,17 +108,17 @@ int dso__read_binary_type_filename(const struct dso *dso,
 	case DSO_BINARY_TYPE__VMLINUX:
 	case DSO_BINARY_TYPE__GUEST_VMLINUX:
 	case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
-		snprintf(filename, size, "%s%s",
+		snprintf(filename, size, "%s/%s",
 			 symbol_conf.symfs, dso->long_name);
 		break;
 
 	case DSO_BINARY_TYPE__GUEST_KMODULE:
-		snprintf(filename, size, "%s%s%s", symbol_conf.symfs,
+		snprintf(filename, size, "%s/%s/%s", symbol_conf.symfs,
 			 root_dir, dso->long_name);
 		break;
 
 	case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE:
-		snprintf(filename, size, "%s%s", symbol_conf.symfs,
+		snprintf(filename, size, "%s/%s", symbol_conf.symfs,
 			 dso->long_name);
 		break;
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index eb06746b06b2..c3549d5955ea 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1468,7 +1468,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
 	if (vmlinux[0] == '/')
 		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s", vmlinux);
 	else
-		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
+		snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s/%s",
 			 symbol_conf.symfs, vmlinux);
 
 	if (dso->kernel == DSO_TYPE_GUEST_KERNEL)

  reply	other threads:[~2014-07-29 12:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25  1:31 [PATCH 1/2] perf tools: Ensure --symfs ends with '/' Namhyung Kim
2014-07-25  1:31 ` [PATCH 2/2] perf tools: Check validity of --symfs value Namhyung Kim
2014-07-25 13:15 ` [PATCH 1/2] perf tools: Ensure --symfs ends with '/' Arnaldo Carvalho de Melo
2014-07-28  1:04   ` Namhyung Kim
2014-07-29  5:02 ` Minchan Kim
2014-07-29 12:33   ` Arnaldo Carvalho de Melo [this message]
2014-07-29 13:26     ` Minchan Kim
2014-07-29 13:43       ` Arnaldo Carvalho de Melo
2014-07-29 15:12       ` Arnaldo Carvalho de Melo
2014-07-29 13:57     ` David Ahern
2014-07-29 23:52     ` Namhyung Kim
2014-07-30 15:19       ` Arnaldo Carvalho de Melo
2014-07-30 20:55         ` Arnaldo Carvalho de Melo
2014-07-30 22:20           ` David Ahern
2014-07-31  4:25           ` Namhyung Kim
2014-07-31 12:26             ` Arnaldo Carvalho de Melo
2014-07-31 23:38               ` Namhyung Kim
2014-08-01 20:15                 ` Arnaldo Carvalho de Melo
2014-08-11  7:38                   ` Namhyung Kim
2014-08-11 13:15                     ` Arnaldo Carvalho de Melo

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=20140729123305.GO7831@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).