Re: [PATCH 1/2] perf tools: Ensure --symfs ends with '/'

From: Arnaldo Carvalho de Melo
Date: Wed Jul 30 2014 - 16:56:26 EST


Em Wed, Jul 30, 2014 at 12:19:32PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 30, 2014 at 08:52:36AM +0900, Namhyung Kim escreveu:
> > I also thought about that way first but changed my mind to the current
> > approach because I don't want to change current behavior.
>
> > I worried about the common case which has empty symfs. By your patch,
> > it makes a pathname absolute even with an empty symfs - I can see most
> > filenames are already absolute paths but I'm not 100% sure it's always
> > the case.
>
> Yeah, after doing some research on the tools/perf/ 'git log' I got your point,
> we can't add the / after symfs usages when it is "", i.e. we need something
> like:
>
> ("%s%s%s, symfs, symfs[0] ? "/" : "", dso_name)
>
> I.e. the equivalent of this:
>
> [acme@zoo linux]$ python
> >>> import os
> >>> symfs = ""
> >>> os.path.join(symfs, "dso_path")
> 'dso_path'
> >>> symfs = "/home/acme/embedded_device_dsos"
> >>> os.path.join(symfs, "dso_path")
> '/home/acme/embedded_device_dsos/dso_path'
> >>>
>
> I'll try and get that in place.

Ok, the patch below should implement it just like above, if Minchan
could please retest, I did just minimal testing, will do more later.

- Arnaldo

---