From root@knight.volant.org  Thu Mar 13 16:35:24 2003
Return-Path: <root@knight.volant.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7F62E37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 13 Mar 2003 16:35:24 -0800 (PST)
Received: from knight.volant.org (knight.volant.org [207.111.218.254])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DC96643FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 13 Mar 2003 16:35:23 -0800 (PST)
	(envelope-from root@knight.volant.org)
Received: from root by knight.volant.org with local (Exim 4.12)
	id 18tdAQ-000OwF-00
	for FreeBSD-gnats-submit@freebsd.org; Thu, 13 Mar 2003 16:35:22 -0800
Message-Id: <E18tdAQ-000OwF-00@knight.volant.org>
Date: Thu, 13 Mar 2003 16:35:22 -0800
From: Pat Lashley <patl+freebsd@volant.org>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Native JDK1.4.1 build fails if WRKDIRPREFIX starts with /d or /i
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         49995
>Category:       ports
>Synopsis:       Native JDK1.4.1 build fails if WRKDIRPREFIX starts with /d or /i
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    phantom
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 13 16:40:13 PST 2003
>Closed-Date:    Wed Nov 05 12:56:52 PST 2003
>Last-Modified:  Wed Nov 05 12:56:52 PST 2003
>Originator:     Pat Lashley
>Release:        FreeBSD 4.8-RC i386
>Organization:
Henry Davis Consulting
>Environment:
System: FreeBSD mccaffrey.phoenix.volant.org 4.8-RC FreeBSD 4.8-RC #1: Sat Mar  8 22:32:11 PST 2003     root@mccaffrey.phoenix.volant.org:/d3/obj/usr/src/sys/MCCAFFREY  i386

	
>Description:
An attempt to build the native JDK 1.4.1 can fail with a message about
*** No rule to make target `.../control/build/bsd-i586/classes/org/omg/
PortableServer/AdapterActivator.class'  Examination of the build log will
reveal that every invocation of the IDL toJavaPortable compiler reports
a bogus 'invalid argument: -td' error.

NOTE that the invalid argument errors do -NOT- cause make errors!!!

The actual cause of the problem is some brain-damage in the arguments
parsing in j2se/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java

For each argument checked; it first verifies that it starts with a
dash or a slash.  (If not, an invalidargument exception is thrown.)
It then makes a lower-case copy of the argument, minus that first
character; and proceeds to compare the lowercased string against
each of the recognized parameters.  If it doesn't find a match,
the parameter, and any immediately following parameters that don't
start with a dash or a slash are copied into a vector to be passed
to the parseOtherArgs() function.  (Which is there to provide a
mechanism for subclasses to recognize additional parameters.)

The problem lies with the checking for the '-i' and '-d' parameters.
They each take an additional string; which is concatenated directly
to the parameter rather than being a following parameter.  (E.g.,
'-dmumble' rather than '-d mumble').

This means that a unix-style filepath option to an 'extra' parameter
may not start with a 'd' or a 'i'.  In a FreeBSD ports install, this
is only a problem if WRKDIRPREFIX is set to something starting /d
or /i  Which in my case, it was.  (I share a single ports tree via
NFS mounts and set WRKDIRPREFIX to space on a local partition on
each machine to avoid conflicts.  In this case, the WRKDIRPREFIX
was set to /d4/FreeBSDobj.)
	
>How-To-Repeat:
Set the WRKDIRPREFIX environment variable to some path that starts with /d
or /i (E.g., /disk2).  (Note that this has to be the actual path, not a
symlink.)

cd /usr/ports/java/jdk14
make build

>Fix:

This patch modifies the argument parsing loops to only remove the leading
char if it is a dash.

--- ../../j2se/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java.~1~	
Fri Sep  6 00:16:27 2002
+++ ../../j2se/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java	
Thu Mar 13 15:30:33 2003
@@ -100,7 +100,15 @@
 	    for (i = 0; i < args.length - 1; ++i) {
 		if (args[i].charAt (0) != '-' && args[i].charAt (0) != '/')
 		    throw new InvalidArgument (args[i]);
-		String lcArg = args[i].substring (1).toLowerCase ();
+		
+		String lcArg = args[i].toLowerCase ();
+
+		//  NOTE that if we were to also chop off a leading /, we
+		//  would have problems with parameters to 'other' args
+		//  which consist of unix-style filepaths which have
+		//  mountpoints starting with /d or /i
+		if (args[i].charAt (0) == '-')
+		    lcArg = lcArg.substring (1);
 
 		// Include path
 		if (lcArg.equals ("i")) {
--- ../../j2se/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java.~1~	Fri Sep  6 00:16:36 2002
+++ ../../j2se/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java	Thu Mar 13 15:28:51 2003
@@ -77,7 +77,9 @@
 
         if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
           throw new InvalidArgument (args[i]);
-        lcArg = lcArg.substring (1);
+
+	if (lcArg.charAt (0) == '-')
+	  lcArg = lcArg.substring (1);
 
         // Proxy options; default is -fclient.
         if (lcArg.startsWith ("f"))
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->phantom 
Responsible-Changed-By: arved 
Responsible-Changed-When: Sat Mar 22 12:45:35 PST 2003 
Responsible-Changed-Why:  
Over to Maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=49995 
State-Changed-From-To: open->closed 
State-Changed-By: phantom 
State-Changed-When: Wed Nov 5 12:55:53 PST 2003 
State-Changed-Why:  
Patches were commited into main BSD/Java repo and available in mainstream 
since -p3. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=49995 
>Unformatted:
