Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Mar 2008 08:41:06 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Greg Lewis <glewis@eyesbeyond.com>
Cc:        freebsd-java@freebsd.org
Subject:   Re: jdk15/javaws on amd64
Message-ID:  <20080318214106.GA69742@server.vk2pj.dyndns.org>
In-Reply-To: <20080318061525.GQ44676@server.vk2pj.dyndns.org>
References:  <20080316223054.GA46447@server.vk2pj.dyndns.org> <20080317133144.GA4473@misty.eyesbeyond.com> <20080318061525.GQ44676@server.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 18, 2008 at 05:15:25PM +1100, Peter Jeremy wrote:
>I've done some poking at it with both some printf()s and gdb and it
>appears to be a gcc bug - in fact, I'm surprised it works at all...
>
>The relevant function is GetBootClassPath():
>char* GetBootClassPath(void) {
>  static char bootclasspath[MAXPATHLEN];
>#ifdef _DEBUG
>  sprintf(bootclasspath, "%s%c%s%c%s%c%s",=20
>                sysGetJarLib(), FILE_SEPARATOR, "javaws_g.jar",
>                PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy_g.=
jar");
>#else
>  sprintf(bootclasspath, "%s%c%s%c%s%c%s",=20
>                sysGetJarLib(), FILE_SEPARATOR, "javaws.jar",
>                PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy.ja=
r");
>#endif
>  return bootclasspath;
>}

I've done a bit more investigating and the problem is that
sysGetJarLib() returns char*, and this is assumed by the above code.
But there is no prototype in scope for the above code so gcc assumes
that sysGetJarLib() returns int and passes it to sprintf as an int.

Looking further, there is no prototype for sysGetJarLib() anywhere in
the source code - or, for that matter many of the other functions in
deploy/src/javaws/share/native/system.c that also return char*.

This code can't work correctly on any platform where
sizeof(int) !=3D sizeof(void*) so I'm not quite sure how Sun make it
work on Sun SPARC...

I'm currently trying to rebuild Java with -Wall to see how many of
these sorts of bugs exist.  In the meantime, I would suggest that
java is broken on any 64-bit architecture.

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--wac7ysb48OaltWcw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.8 (FreeBSD)

iEYEARECAAYFAkfgNvIACgkQ/opHv/APuIcyIgCfXHekeNHOWDXXKzAAXgHKuvT1
+LwAnRf88tZFD1XgZn+ADtwYcVgYk6/b
=yKa9
-----END PGP SIGNATURE-----

--wac7ysb48OaltWcw--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080318214106.GA69742>