harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: Problem met when building jdktools alone
Date Tue, 03 Aug 2010 11:04:18 GMT

In message <201008030825.o738PJ02014021@d12av03.megacenter.de.ibm.com>,
Mark Hindess writes:
> 
> In message <AANLkTimC0wjn_NrY0CAhjafD=dELbzypp_MFgNtT-VDY@mail.gmail.com>,
> Charles Lee writes:
> >
> > see this:
> > http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe
> > 
> > It seems a little different on FreeBSD.
> 
> I've reverted my change in r981763 so FreeBSD is already implemented.
> We need implementations for Aix and z/OS.  Unless anyone has more
> specific AIX and/or z/OS implementations, then I think we should just
> fall back to a solution like main_get_executable_name from:
> 
>   classlib/modules/luni/src/main/native/launcher/unix/main_hlp.c
> 
> However reading this code it has several issues - like the pointless
> directory changing in the !isSymbolicLink case and the use of
> readSymbolicLink when realpath would be more appropriate - so I'd rather
> fix it correctly then port the fixes back to the launcher (and portlib
> hysysinfo.c IIRC).

I also noticed that the main_hlp.c version searches the PATH by reading
the directory entries and doing string comparison.  This seems like a
bad idea for several reasons:

1) It is slow

2) It doesn't check for execute permission so it can return the
incorrect answer in the case that a non-executable match is found before
the correct (executable match) later in the path.

r981763 fixed it for Linux.  I've also committed r981820 that should fix
it for AIX and z/OS.  Testing on those two platforms and review of the
new code would be very welcome.  (I'll change the launcher version in a
few days time.)

Regards,
 Mark.



Mime
View raw message