From owner-freebsd-java@FreeBSD.ORG Tue Mar 18 21:41:15 2008 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 393DB106564A for ; Tue, 18 Mar 2008 21:41:15 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id D21B08FC13 for ; Tue, 18 Mar 2008 21:41:14 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m2ILf7K6006097 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Mar 2008 08:41:08 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.1) with ESMTP id m2ILf7gw069808; Wed, 19 Mar 2008 08:41:07 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m2ILf6UJ069807; Wed, 19 Mar 2008 08:41:06 +1100 (EST) (envelope-from peter) Date: Wed, 19 Mar 2008 08:41:06 +1100 From: Peter Jeremy To: Greg Lewis Message-ID: <20080318214106.GA69742@server.vk2pj.dyndns.org> References: <20080316223054.GA46447@server.vk2pj.dyndns.org> <20080317133144.GA4473@misty.eyesbeyond.com> <20080318061525.GQ44676@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wac7ysb48OaltWcw" Content-Disposition: inline In-Reply-To: <20080318061525.GQ44676@server.vk2pj.dyndns.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-java@freebsd.org Subject: Re: jdk15/javaws on amd64 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2008 21:41:15 -0000 --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--