From mboxrd@z Thu Jan 1 00:00:00 1970 From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers) Date: Thu, 14 Nov 2013 13:46:27 +0000 (UTC) Subject: [lttng-dev] [lttng-tools PATCH 3/4] Correct the behavior of the utils_expand_path function In-Reply-To: References: <1384320878-28808-1-git-send-email-raphael.beamonte@gmail.com> <20131112195134.GB12183@thessa> <1384320878-28808-4-git-send-email-raphael.beamonte@gmail.com> <647704866.66921.1384397059144.JavaMail.zimbra@efficios.com> Message-ID: <660157471.67103.1384436787478.JavaMail.zimbra@efficios.com> ----- Original Message ----- > From: "Rapha?l Beamonte" > To: "Mathieu Desnoyers" > Cc: "David Goulet" , lttng-dev at lists.lttng.org > Sent: Wednesday, November 13, 2013 10:27:03 PM > Subject: Re: [lttng-dev] [lttng-tools PATCH 3/4] Correct the behavior of the utils_expand_path function > > > I might be missing something, but how about, instead: > > > > 1) if path start with /, directly pass it to realpath() > > 2) if path does not start with /, prepend getcwd() to it, and then call > > realpath() on the result. > > > > If we can do the same result as this patch without reimplementing tricky > > string handling, we should really aim for re-using existing libraries. > > > > Thoughts ? > > Hello Mathieu, > > Thing is realpath only works if the path exists (realpath(3)). I > perhaps want to give as argument an absolute path that does not exist, > or a path containing strings such as '../' or './'. In such cases, > realpath would do no good, and if we don't accept to use unexisting > paths, then there is no point in using a recursive mkdir. > If fact, if realpath would work in such cases, using an 'if' would not > even be necessary, we could just call realpath and let it resolve the > current directory if necessary. > > Hope it helps to understand, Yes, it does, thank you! Mathieu > > Rapha?l > -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com