Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2003 16:35:22 -0800
From:      Pat Lashley <patl+freebsd@volant.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/49995: Native JDK1.4.1 build fails if WRKDIRPREFIX starts with /d or /i
Message-ID:  <E18tdAQ-000OwF-00@knight.volant.org>

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

>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:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 13 16:40:13 PST 2003
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E18tdAQ-000OwF-00>