Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 60606 - java-config fails when PYTHONHOME is set
Summary: java-config fails when PYTHONHOME is set
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: InVCS
: 69064 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-16 15:53 UTC by walt
Modified: 2005-12-10 11:52 UTC (History)
2 users (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 walt 2004-08-16 15:53:41 UTC
The configure script for OpenOffice (CVS sources) sets JAVAHOME to some
path of its own choosing and this makes java-config fail while trying to
compile OpenOffice.

Is it possible to modify java-config to work around this?

In this case OpenOffice is actually calling apache-ant which is calling
java-config, so I'll just trying hacking apache-ant for now.  But a permanent
fix would be swell.

Reproducible: Always
Steps to Reproduce:
1.Set JAVAHOME to any arbitrary value
2.Run java-config
3.

Actual Results:  
$java-config -L
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/java-config", line 13, in ?
    import sys, getopt, os
ImportError: No module named getopt
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-08-18 11:55:21 UTC
I suggest we move *all* necessary env vars for java-config and java in general
into /etc/env.d/java/, and let java-config source /etc/env.d/java/21java explicitly.

This way, the user may set JAVA_HOME, CLASSPATH, and whatever to completely absurd 
values and java-config will still work.
Comment 2 walt 2004-08-18 13:00:19 UTC
Hell's Bells -- I just realized that I was typing JAVAHOME when I really meant
PYTHONHOME.  (Java-config is a python program, after all.)  Even the subject of
this bug report has a bug in it  :o(  Sorry.

What I had in mind was doing exactly what you suggested, except source the
proper python environment instead of the java environment -- or even both,
which seems sensible.

I don't know enough python to know if a python script can be made to ignore
or reset environment variables, or whether java-config would need to be a 
shell script which sets up the right environment before calling the python 
program.
Comment 3 Thomas Matthijs (RETIRED) gentoo-dev 2004-09-29 02:46:04 UTC
i see 2 options atm
1) I don't realy know python _that_ well but from what i read in the docs it should be possible to explicitly add the search path's it needs
2) make java-config a bash script that set/unset it and runs the python java-config

but i don't realy like them
Comment 4 Thomas Matthijs (RETIRED) gentoo-dev 2004-11-05 03:48:09 UTC
a better way might be start java-config with

#!/usr/bin/python -E 

i wonder if that works the way i think it does?
Comment 5 Saleem Abdulrasool (RETIRED) gentoo-dev 2005-02-04 18:35:30 UTC
*** Bug 69064 has been marked as a duplicate of this bug. ***
Comment 6 Frank Lomax 2005-02-05 14:45:49 UTC
I was the poster of bug 69064.  The fix is to change the #! line of /usr/bin/java-config to point to /usr/bin/python and *not* the first python on $PATH.  The former has what it needs in its pythonpath.
Comment 7 Thomas Matthijs (RETIRED) gentoo-dev 2005-02-05 14:50:50 UTC
having
#!/usr/bin/python -E
in it should fix both no?
Comment 8 Saleem Abdulrasool (RETIRED) gentoo-dev 2005-02-05 19:59:31 UTC
Changing it to /usr/bin/evn python -E is the proper fix as it will ignore the environment variables.

This will be fixed sometime shortly (I hope).  I have already incorporated this into the "next generation" of java-config.  If you can change the execution line to #! /usr/bin/env python -E and test, it would be very helpful.
Comment 9 walt 2005-02-05 20:43:50 UTC
The problem I see with /usr/bin/env python -E is that the
script complains that it can't find the file -E.  Somehow
the -E isn't being passed to python properly.

However /usr/bin/python -E works perfectly, even when PYTHONHOME
is set to something absurd.
Comment 10 Saleem Abdulrasool (RETIRED) gentoo-dev 2005-02-05 22:37:00 UTC
Hmm, thats why we test :-p.  Forgot, /usr/bin/env python -E is bad form.  The reason for that is that the use of /usr/bin/env with multiple parameters is bad as the results are somewhat random as it can be interpreted differently on different systems.  I would have to agree that /usr/bin/python may be the best choice in light of that.
Comment 11 Frank Lomax 2005-04-18 16:02:04 UTC
Because java-config requires a package that is only installed in /usr/bin/python, then it should not use "#! /usr/bin/env python".  It must use "#! /usr/bin/python"  

What's the state of this bug?  java-config really really needs to be fixed, and the fix is trivial!
Comment 12 Saleem Abdulrasool (RETIRED) gentoo-dev 2005-04-19 08:10:44 UTC
We are currently working on a new java-config which will address all of the current issues with java-config.  This issue has already been resolved in the new version, however, the new version is still not ready for production yet.
Comment 13 Joey Stanford 2005-05-20 12:44:40 UTC
This is not the only item that's failing during the OpenOffice compile.
---output---
/ooo/ooo_SRC680_m103_src> java-config -L
[sun-jdk-1.4.2.08] "Sun JDK 1.4.2.08" (/etc/env.d/java/20sun-jdk-1.4.2.08) *
/ooo/ooo_SRC680_m103_src> source ./LinuxIntelEnv.Set
/ooo/ooo_SRC680_m103_src> java-config -L
Traceback (most recent call last):
  File "/usr/bin/java-config", line 14, in ?
    from java_config import jc_options
ImportError: No module named java_config
---output---

This is blocking http://eo.openoffice.org as we do our development on the gentoo
project.
Comment 14 Frank Lomax 2005-05-20 12:58:04 UTC
Joey, a work around is to edit your /usr/bin/java-config script so that the
first line says:

#!/usr/bin/python

I've done this on all my Gentoo boxes until the new java-config lands.
Comment 15 Andreas Proschofsky (RETIRED) gentoo-dev 2005-06-05 05:40:35 UTC
Just wanted to add, that we really need this fixed for OOo 2.0, so any timeline
for a fix or the new version going in portage?
Comment 16 Jan Brinkmann (RETIRED) gentoo-dev 2005-06-05 05:55:13 UTC
java-config-ng is probably month away
Comment 17 Thomas Matthijs (RETIRED) gentoo-dev 2005-06-18 06:48:14 UTC
made a revision bump that simply applies
-#!/usr/bin/env python
+#!/usr/bin/python -E
to not hold anyone up any longer while be fix the rest of java-config
Comment 18 Andreas Proschofsky (RETIRED) gentoo-dev 2005-06-18 12:41:47 UTC
@axxo: thanks, works here :)
Comment 19 Saleem Abdulrasool (RETIRED) gentoo-dev 2005-12-10 11:52:12 UTC
This has been fixed in portage with java-config-1.2.11-r1.