[pacman-dev] [PATCH] repo-add: bash implementation of realpath

Xavier shiningxc at gmail.com
Mon Feb 16 04:25:58 EST 2009


On Mon, Feb 16, 2009 at 4:20 AM, Dan McGee <dpmcgee at gmail.com> wrote:
> On Sun, Feb 15, 2009 at 8:44 PM, Allan McRae <allan at archlinux.org> wrote:
>>
>> Did anyone provide differences in speed when using the bash "realpath"  to
>> the actual binary one?  My guess is that the speed difference will be
>> minimal, even when regenerating an entire repo db, but it would pay to
>> check.
>
> I agree, especially after the speed differences Xavier pointed out
> with my other repo-add patch.
>

bash realpath
real	0m3.138s
user	0m0.887s
sys	0m1.710s

readlink -f
real	0m0.734s
user	0m0.210s
sys	0m0.507s

Before moving forward, I have a question :
is there any good and portable way to convert between absolute and
relative paths?
I don't see any reason for doing any symlinks resolution anywhere.
The only thing we need is to convert a given path (which can be either
absolute or relative) to an absolute path.
We need this because we are changing directories, and these paths have
to stay valid so have to be absolute.

Another alternative for getting rid of realpath/readlink is to avoid
changing directories in the first place. This might also be possible
but probably requires more work.


More information about the pacman-dev mailing list