Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 149460 - java-config misbehaves with --select-vm
Summary: java-config misbehaves with --select-vm
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High major
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on: 161021
Blocks: 149451
  Show dependency tree
 
Reported: 2006-09-28 16:19 UTC by Krzysztof Pawlik (RETIRED)
Modified: 2007-02-03 14:01 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Pawlik (RETIRED) gentoo-dev 2006-09-28 16:19:31 UTC
# java-config -L
1) Blackdown JDK 1.3.1 [blackdown-jdk-1.3] (/usr/share/java-config-2/vm/blackdown-jdk-1.3)
*) Blackdown JDK 1.4.2.03 [blackdown-jdk-1.4.2] (/usr/share/java-config-2/vm/blackdown-jdk-1.4.2)
3) Blackdown JRE 1.4.2.03 [blackdown-jre-1.4.2] (/usr/share/java-config-2/vm/blackdown-jre-1.4.2)
4) IBM JDK 1.4.2.5 [ibm-jdk-bin-1.4] (/usr/share/java-config-2/vm/ibm-jdk-bin-1.4)
5) IBM JRE 1.4.2.5 [ibm-jre-bin-1.4] (/usr/share/java-config-2/vm/ibm-jre-bin-1.4)
6) WebLogic JRockit 1.4.2.11 [jrockit-jdk-bin-1.4] (/usr/share/java-config-2/vm/jrockit-jdk-bin-1.4)
7) WebLogic JRockit 1.5.0.06 [jrockit-jdk-bin-1.5] (/usr/share/java-config-2/vm/jrockit-jdk-bin-1.5)
8) Kaffe 1.1.7 [kaffe] (/usr/share/java-config-2/vm/kaffe)
9) Sun JDK 1.3.1.17 [sun-jdk-1.3] (/usr/share/java-config-2/vm/sun-jdk-1.3)
10) Sun JDK 1.4.2.12 [sun-jdk-1.4] (/usr/share/java-config-2/vm/sun-jdk-1.4)
11) Sun JDK 1.5.0.07 [sun-jdk-1.5] (/usr/share/java-config-2/vm/sun-jdk-1.5)
12) Sun JDK 1.6.0.0_beta95 [sun-jdk-1.6] (/usr/share/java-config-2/vm/sun-jdk-1.6)
13) Sun JRE 1.4.2.12 [sun-jre-bin-1.4] (/usr/share/java-config-2/vm/sun-jre-bin-1.4)
14) Sun JRE 1.5.0.08 [sun-jre-bin-1.5] (/usr/share/java-config-2/vm/sun-jre-bin-1.5)

# java-config -O
/opt/blackdown-jdk-1.4.2.03
# java-config --select-vm= -O
/opt/sun-jre-bin-1.5.0.08

looks like java-config choses last entry when empty --select-vm is given - it should use system/user VM instead - just ignore --select-vm if it's empty. Proposed patch:

Index: src/java-config-2
===================================================================
--- src/java-config-2   (revision 2951)
+++ src/java-config-2   (working copy)
@@ -258,6 +258,8 @@
 def select_vm(option, opt, value, parser):
     vm = manager.get_vm(value)
     if vm:
+        if vm == '':
+            return
         manager.set_active_vm(manager.get_vm(value))
     else:
         fatalError("The vm could not be found")
Comment 1 Krzysztof Pawlik (RETIRED) gentoo-dev 2006-09-28 16:23:41 UTC
Sorry, correct patch:

Index: src/java-config-2
===================================================================
--- src/java-config-2   (revision 2951)
+++ src/java-config-2   (working copy)
@@ -256,6 +256,8 @@
     manager.clean_classpath(user_classpath_target())

 def select_vm(option, opt, value, parser):
+    if value == '':
+        return
     vm = manager.get_vm(value)
     if vm:
         manager.set_active_vm(manager.get_vm(value))
Comment 2 unlord 2006-09-28 16:30:17 UTC
I was the one that stumbled upon this bug.  After applying the second patch below, it works fine.  Here is the output of my patched java-config-2:

# java-config-2 --select-vm= -O
/opt/blackdown-jdk-1.4.2.03
Comment 3 Josh Nichols (RETIRED) gentoo-dev 2006-09-28 17:10:35 UTC
Giving an error when --select-vm is empty is probably a better solution.
Comment 4 Josh Nichols (RETIRED) gentoo-dev 2006-09-28 20:41:50 UTC
Regardless of the fix we do, we should belay doing a release that fixes this until after the new system stabilizes. I'd rather not do any more bumps until after its done.
Comment 5 Krzysztof Pawlik (RETIRED) gentoo-dev 2006-09-29 01:28:08 UTC
(In reply to comment #3)
> Giving an error when --select-vm is empty is probably a better solution.

IMHO ignoring --select-vm if it has empty value is safer behaviour, and allows such use cases like in Resin's init.d script. If it errors on empty value passed - that adds additional code to check if it empty, do something, if it's not empty, do something other. Complicates it. I'm for ignoring it.

(In reply to comment #4)
> Regardless of the fix we do, we should belay doing a release that fixes this
> until after the new system stabilizes. I'd rather not do any more bumps until
> after its done.>

It can be batched together with other fixes (if there are any) as rev-bumped to 2.0.30-r1
Comment 6 Krzysztof Pawlik (RETIRED) gentoo-dev 2007-01-08 22:08:19 UTC
Josh: any progress on this issue?
Comment 7 Josh Nichols (RETIRED) gentoo-dev 2007-01-08 22:29:16 UTC
Since things are stable now, it shouldn't be a problem going ahead with a bump.

Although, I still stand by my previous statement, that not giving an argument should generate an error.
Comment 8 Krzysztof Pawlik (RETIRED) gentoo-dev 2007-01-08 22:45:18 UTC
(In reply to comment #7)
> Since things are stable now, it shouldn't be a problem going ahead with a bump.
> 
> Although, I still stand by my previous statement, that not giving an argument
> should generate an error.

I've changed init.d script for resin-3.1.0 and resin-3.0.22 to behave well with empty GENTOO_VM, so I don't have any objections about making it generate an error after 3.0.22 goes stable.
Comment 9 Krzysztof Pawlik (RETIRED) gentoo-dev 2007-02-03 14:01:04 UTC
(In reply to comment #7)
> Since things are stable now, it shouldn't be a problem going ahead with a bump.
> 
> Although, I still stand by my previous statement, that not giving an argument
> should generate an error.

resin-3.0.21 (which used empty GENTOO_VM) has been removed, so this bug is invalid now.