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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Aug 2014 16:38:17 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:	Minchan Kim <minchan@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Jiri Olsa <jolsa@...hat.com>, David Ahern <dsahern@...il.com>
Subject: Re: [PATCH 1/2] perf tools: Ensure --symfs ends with '/'

Hi Arnaldo,

On Fri, 1 Aug 2014 17:15:38 -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Aug 01, 2014 at 08:38:02AM +0900, Namhyung Kim escreveu:
>> Hi Arnaldo,
>> 
>> On Thu, 31 Jul 2014 09:26:21 -0300, Arnaldo Carvalho de Melo wrote:
>> > Em Thu, Jul 31, 2014 at 01:25:52PM +0900, Namhyung Kim escreveu:
>> >> 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.
>
>> Then I think you also need to care about trailing and leading '/' in the
>> components so that, say, joining '/home/' and '/namhyung/' can result in
>> '/home/namhyung/' not '/home///namhyung/'.
>
> Well, "/home/namhyung/" is the same as "/home///namhyung/" for POSIX:
> http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266
>
> So, when we can easily avoid it, no use to have a sequence of slashes,
> but otherwise it is harmless.

Yes, I know it's supported.  But I think it'd be better off avoiding it
in order to be an elegant path joiner. :)


>  
>> Btw, it seems like python's os.path.join() just use latter if it's an
>> absolute path.
>> 
>>   $ python
>>   Python 2.7.3 (default, Jul 24 2012, 10:05:38) 
>>   [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
>>   Type "help", "copyright", "credits" or "license" for more information.
>>   >>> import os.path
>>   >>> os.path.join('/home/', '/namhyung/')
>>   '/namhyung/'
>
> Interesting, wonder what is the rationale for that or if this is a bug.

Hmm.. pydoc os.path.join says below:

 os.path.join = join(a, *p)

    Join two or more pathname components, inserting '/' as needed.  If
    any component is an absolute path, all previous path components will
    be discarded.  An empty last part will result in a path that ends
    with a separator.


Thanks,
Namhyung
--
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