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

From: Arnaldo Carvalho de Melo
Date: Thu Jul 31 2014 - 08:26:31 EST


Em Thu, Jul 31, 2014 at 01:25:52PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
>
> On Wed, 30 Jul 2014 17:55:21 -0300, Arnaldo Carvalho de Melo wrote:
> > 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:

> >> [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.

> Are you still against my approach - adding '/' at the end of the symfs
> string itself? It seems that mine is simpler and shorter.

Yes, I am.

We are not just concatenating two strings, we are joining two path
components.

I think it is more clear and elegant to do it as python os.path.join()
does.

- Arnaldo
--
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/