Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297687 - dev-java/java-config: gjl launcher will override env variables (including PATH) from VM's env file when VM is providing a java-virtual
Summary: dev-java/java-config: gjl launcher will override env variables (including PAT...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High major (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2009-12-20 19:37 UTC by Koen Smets
Modified: 2010-04-28 19:46 UTC (History)
0 users

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 Koen Smets 2009-12-20 19:37:57 UTC
I emerged jabref-2.6_beta2 and noticed a serious problem as it doesn't open files/url in external problems.

After looking at the code, I tried to simulate JabRefs behavior using the code listed below, which opens the firefox browser as it supposed to do!

$ cat Test.java 
import java.io.IOException;

class Test {
        public static void main(String[] args) {
                String cmdArray[] = new String[2];
                cmdArray[0] = "firefox";
                cmdArray[1] = "bugs.gentoo.org";
                try {
                        Process child = Runtime.getRuntime().exec(cmdArray);
                } catch (IOException e) {
                        System.err.println("An error occured on the command: "
                                + cmdArray[0] + " " + cmdArray[1]);
                }
        }
}

Reproducible: Always

Steps to Reproduce:
1. # echo "dev-java/glazedlists java5" >> /etc/portage/package.use
2. # emerge -e =app-text/jabref-2.6_beta2
3. $ jabref
4. create new entry with url and/or file
5. click on url/file icon in JabRef's main window after
Actual Results:  
$ jabref
Dec 20, 2009 8:10:40 PM net.sf.jabref.plugin.PluginCore initialize
INFO: Found 2 plugin(s):
  - net.sf.jabref.core (jar:file:/usr/share/jabref/lib/jabref.jar!/plugins/net.sf.jabref.core/plugin.xml)
  - net.sf.jabref.export.misq (jar:file:/usr/share/jabref/lib/jabref.jar!/plugins/net.sf.jabref.export.misq/plugin.xml)

An error occured on the command: firefox bugs.gentoo.org

msgbox("Could not open link", "Unable to open link. The application 'acroread' associated with the file 'PDF' could not be called.", OK)

Expected Results:  
JabRef should open url/pdf in firefox respectively acroread.

$ emerge --info
Portage 2.1.7.15 (hardened/linux/amd64/10.0, gcc-4.3.4, glibc-2.11-r1, 2.6.29-hardened x86_64)
=================================================================
System uname: Linux-2.6.29-hardened-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T8100_@_2.10GHz-with-gentoo-2.0.1
Timestamp of tree: Sun, 20 Dec 2009 15:15:03 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4, 3.1.1-r1
dev-util/ccache:     2.4-r8
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.5.3
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.64
sys-devel/automake:  1.10.3, 1.11.1
sys-devel/binutils:  2.20
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe -fforce-addr"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -O2 -pipe -fforce-addr"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/dev/shm"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acl amd64 berkdb bzip2 cleartype cli corefonts cracklib crypt cups cxx dri gdbm gpm hardened iconv justify mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl pic pppd python readline reflection session spl sse sse2 ssl sysfs tcpd truetype type1 urandom vim-syntax xorg zlib" ALSA_CARDS="hda-intel usb-adio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Koen Smets 2009-12-20 19:42:35 UTC
(In reply to comment #0)

Please note, that the original released jar-file (http://sourceforge.net/projects/jabref/files/jabref/2.6%20beta%202/JabRef-2.6b2.jar/download) runs also perfectly on my system.
Comment 2 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-02-10 23:16:11 UTC
Can you post the output of the following from the same terminal window:

java -version

GJL_DEBUG=1 jabref

see if the error produces anything more in the terminal, and in jabref's error console exception tab? (under menu help)

(In reply to comment #1)
> (In reply to comment #0)
> 
> Please note, that the original released jar-file
> (http://sourceforge.net/projects/jabref/files/jabref/2.6%20beta%202/JabRef-2.6b2.jar/download)
> runs also perfectly on my system.
> 

Did you run it with java -jar jabref.jar or replaced the jar in /usr/share/jabref and run with our jabref launcher?
Comment 3 Koen Smets 2010-02-11 08:02:43 UTC
$ java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

$ GJL_DEBUG=1 jabref
Calling: gjl --package jabref --get-args --get-vm
Using: 
Running: exec java  -classpath /usr/share/xsdlib/lib/xsdlib.jar:/usr/share/jaxme/lib/jaxmejs.jar:/usr/share/bcmail/lib/bcmail.jar:/usr/share/xml-commons-resolver/lib/xml-commons-resolver.jar:/usr/share/ant-core/lib/ant.jar:/usr/share/jabref/lib/jabref.jar:/usr/share/asm-1.5/lib/asm-attrs.jar:/usr/share/jdom-1.0/lib/jdom.jar:/usr/share/sun-jaf/lib/activation.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-jdk14.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz.jar:/usr/share/xpp3/lib/xpp3.jar:/usr/share/servletapi-2.4/lib/jsp-api.jar:/usr/share/xalan-serializer/lib/serializer.jar:/usr/share/jgoodies-looks-2.0/lib/looks.jar:/usr/share/cglib-2.1/lib/cglib.jar:/usr/share/ant-core/lib/ant-launcher.jar:/usr/share/jpfcodegen/lib/JPFCodeGenerator-rt.jar:/usr/share/commons-lang-2.1/lib/commons-lang.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-core.jar:/usr/share/jaxme/lib/jaxmexs.jar:/usr/share/commons-logging/lib/commons-logging-adapters.jar:/usr/share/trove/lib/trove.jar:/usr/share/microba/lib/microba.jar:/usr/share/jabref/lib/antlr-3.0b5.jar:/usr/share/dom4j-1/lib/dom4j.jar:/usr/share/sun-javamail/lib/mail.jar:/usr/share/jdom-jaxen-1.0/lib/jdom-jaxen.jar:/usr/share/tomcat-servlet-api-2.3/lib/servlet.jar:/usr/share/xpp2/lib/PullParser-standard.jar:/usr/share/xalan/lib/xalan.jar:/usr/share/fontbox/lib/fontbox.jar:/usr/share/commons-collections/lib/commons-collections.jar:/usr/share/asm-1.5/lib/kasm.jar:/usr/share/relaxng-datatype/lib/relaxngDatatype.jar:/usr/share/bcel/lib/bcel.jar:/usr/share/jempbox/lib/jempbox.jar:/usr/share/asm-1.5/lib/asm.jar:/usr/share/jgraph/lib/jgraph.jar:/usr/share/glazedlists/lib/glazedlists.jar:/usr/share/jgoodies-forms/lib/forms.jar:/usr/share/javacup/lib/javacup.jar:/usr/share/bcprov/lib/bcprov.jar:/usr/share/concurrent-util/lib/concurrent.jar:/usr/share/xmldb/lib/xmldb-api-sdk.jar:/usr/share/jpfcodegen/lib/JPFCodeGenerator.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-nodeps-jdk14.jar:/usr/share/xerces-2/lib/xercesImpl.jar:/usr/share/xpp2/lib/PullParser-x2.jar:/usr/share/lucene-2.1/lib/lucene-demos.jar:/usr/share/xpp2/lib/PullParser.jar:/usr/share/werken-xpath/lib/werken.xpath.jar:/usr/share/xml-commons-external-1.3/lib/xml-apis.jar:/usr/share/xml-commons-external-1.3/lib/xml-apis-ext.jar:/usr/share/avalon-logkit-2.0/lib/avalon-logkit.jar:/usr/share/jaxme/lib/jaxme2.jar:/usr/share/antlr/lib/antlr.jar:/usr/share/lucene-2.1/lib/lucene-core.jar:/usr/share/glassfish-jms-api/lib/glassfish-jms-api.jar:/usr/share/jrexx/lib/jrexx.jar:/usr/share/servletapi-2.4/lib/servlet-api.jar:/usr/share/ant-core/lib/ant-bootstrap.jar:/usr/share/jakarta-oro-2.0/lib/jakarta-oro.jar:/usr/share/jsr173/lib/jsr173.jar:/usr/share/jpf-1.5/lib/jpf.jar:/usr/share/log4j/lib/log4j.jar:/usr/share/jaxme/lib/jaxmeapi.jar:/usr/share/pdfbox/lib/pdfbox.jar:/usr/share/jdom-1.0_beta9/lib/jdom.jar:/usr/share/qdox-1.6/lib/qdox.jar:/usr/share/commons-logging/lib/commons-logging.jar:/usr/share/asm-1.5/lib/asm-xml.jar:/usr/share/velocity/lib/velocity.jar:/usr/share/jaxme/lib/jaxmepm.jar:/usr/share/xpp2/lib/PullParser-intf.jar:/usr/share/cglib-2.1/lib/cglib-nodep.jar:/usr/share/iso-relax/lib/isorelax.jar:/usr/share/asm-1.5/lib/asm-analysis.jar:/usr/share/spin/lib/spin.jar:/usr/share/junit/lib/junit.jar:/usr/share/jpf-1.5/lib/jpf-tools.jar:/usr/share/jaxme/lib/jaxme2-rt.jar:/usr/share/msv/lib/msv.jar:/usr/share/xmldb/lib/xmldb-api.jar:/usr/share/saxpath/lib/saxpath.jar:/usr/share/commons-logging/lib/commons-logging-api.jar:/usr/share/asm-1.5/lib/asm-util.jar:/usr/share/asm-1.5/lib/asm-tree.jar:/usr/share/jpf-1.5/lib/jpf-boot.jar:/usr/share/jdom-jaxen-1.0_beta9/lib/jdom-jaxen.jar -Djava.library.path=/lib:/usr/lib  net.sf.jabref.JabRef  
Feb 11, 2010 8:59:38 AM net.sf.jabref.plugin.PluginCore initialize
INFO: Found 2 plugin(s):
  - net.sf.jabref.core (jar:file:/usr/share/jabref/lib/jabref.jar!/plugins/net.sf.jabref.core/plugin.xml)
  - net.sf.jabref.export.misq (jar:file:/usr/share/jabref/lib/jabref.jar!/plugins/net.sf.jabref.export.misq/plugin.xml)
Comment 4 Koen Smets 2010-02-11 08:08:34 UTC
Please note, if I run 
$ GJL_DEBUG=1 jabref
No extra error messages are produced in the terminal, nor in jabref's error
console exception tab (under menu help), but the problem still exists.

But, if I run jabref directly from the bash commandline using
$ java  -classpath /usr/share/xsdlib/lib/xsdlib.jar:/usr/share/jaxme/lib/jaxmejs.jar:/usr/share/bcmail/lib/bcmail.jar:/usr/share/xml-commons-resolver/lib/xml-commons-resolver.jar:/usr/share/ant-core/lib/ant.jar:/usr/share/jabref/lib/jabref.jar:/usr/share/asm-1.5/lib/asm-attrs.jar:/usr/share/jdom-1.0/lib/jdom.jar:/usr/share/sun-jaf/lib/activation.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-jdk14.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz.jar:/usr/share/xpp3/lib/xpp3.jar:/usr/share/servletapi-2.4/lib/jsp-api.jar:/usr/share/xalan-serializer/lib/serializer.jar:/usr/share/jgoodies-looks-2.0/lib/looks.jar:/usr/share/cglib-2.1/lib/cglib.jar:/usr/share/ant-core/lib/ant-launcher.jar:/usr/share/jpfcodegen/lib/JPFCodeGenerator-rt.jar:/usr/share/commons-lang-2.1/lib/commons-lang.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-core.jar:/usr/share/jaxme/lib/jaxmexs.jar:/usr/share/commons-logging/lib/commons-logging-adapters.jar:/usr/share/trove/lib/trove.jar:/usr/share/microba/lib/microba.jar:/usr/share/jabref/lib/antlr-3.0b5.jar:/usr/share/dom4j-1/lib/dom4j.jar:/usr/share/sun-javamail/lib/mail.jar:/usr/share/jdom-jaxen-1.0/lib/jdom-jaxen.jar:/usr/share/tomcat-servlet-api-2.3/lib/servlet.jar:/usr/share/xpp2/lib/PullParser-standard.jar:/usr/share/xalan/lib/xalan.jar:/usr/share/fontbox/lib/fontbox.jar:/usr/share/commons-collections/lib/commons-collections.jar:/usr/share/asm-1.5/lib/kasm.jar:/usr/share/relaxng-datatype/lib/relaxngDatatype.jar:/usr/share/bcel/lib/bcel.jar:/usr/share/jempbox/lib/jempbox.jar:/usr/share/asm-1.5/lib/asm.jar:/usr/share/jgraph/lib/jgraph.jar:/usr/share/glazedlists/lib/glazedlists.jar:/usr/share/jgoodies-forms/lib/forms.jar:/usr/share/javacup/lib/javacup.jar:/usr/share/bcprov/lib/bcprov.jar:/usr/share/concurrent-util/lib/concurrent.jar:/usr/share/xmldb/lib/xmldb-api-sdk.jar:/usr/share/jpfcodegen/lib/JPFCodeGenerator.jar:/usr/share/aspectwerkz-2/lib/aspectwerkz-nodeps-jdk14.jar:/usr/share/xerces-2/lib/xercesImpl.jar:/usr/share/xpp2/lib/PullParser-x2.jar:/usr/share/lucene-2.1/lib/lucene-demos.jar:/usr/share/xpp2/lib/PullParser.jar:/usr/share/werken-xpath/lib/werken.xpath.jar:/usr/share/xml-commons-external-1.3/lib/xml-apis.jar:/usr/share/xml-commons-external-1.3/lib/xml-apis-ext.jar:/usr/share/avalon-logkit-2.0/lib/avalon-logkit.jar:/usr/share/jaxme/lib/jaxme2.jar:/usr/share/antlr/lib/antlr.jar:/usr/share/lucene-2.1/lib/lucene-core.jar:/usr/share/glassfish-jms-api/lib/glassfish-jms-api.jar:/usr/share/jrexx/lib/jrexx.jar:/usr/share/servletapi-2.4/lib/servlet-api.jar:/usr/share/ant-core/lib/ant-bootstrap.jar:/usr/share/jakarta-oro-2.0/lib/jakarta-oro.jar:/usr/share/jsr173/lib/jsr173.jar:/usr/share/jpf-1.5/lib/jpf.jar:/usr/share/log4j/lib/log4j.jar:/usr/share/jaxme/lib/jaxmeapi.jar:/usr/share/pdfbox/lib/pdfbox.jar:/usr/share/jdom-1.0_beta9/lib/jdom.jar:/usr/share/qdox-1.6/lib/qdox.jar:/usr/share/commons-logging/lib/commons-logging.jar:/usr/share/asm-1.5/lib/asm-xml.jar:/usr/share/velocity/lib/velocity.jar:/usr/share/jaxme/lib/jaxmepm.jar:/usr/share/xpp2/lib/PullParser-intf.jar:/usr/share/cglib-2.1/lib/cglib-nodep.jar:/usr/share/iso-relax/lib/isorelax.jar:/usr/share/asm-1.5/lib/asm-analysis.jar:/usr/share/spin/lib/spin.jar:/usr/share/junit/lib/junit.jar:/usr/share/jpf-1.5/lib/jpf-tools.jar:/usr/share/jaxme/lib/jaxme2-rt.jar:/usr/share/msv/lib/msv.jar:/usr/share/xmldb/lib/xmldb-api.jar:/usr/share/saxpath/lib/saxpath.jar:/usr/share/commons-logging/lib/commons-logging-api.jar:/usr/share/asm-1.5/lib/asm-util.jar:/usr/share/asm-1.5/lib/asm-tree.jar:/usr/share/jpf-1.5/lib/jpf-boot.jar:/usr/share/jdom-jaxen-1.0_beta9/lib/jdom-jaxen.jar -Djava.library.path=/lib:/usr/lib  net.sf.jabref.JabRef

the problem does not occur and acroread, firefox,... are started properly. Any ideas?
Comment 5 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-02-11 11:49:28 UTC
Meh, found the nasty reason, changing summary.
The problem is that the gjl launcher will export variables listed in ENV_VARS in package.env of requested packages and its dependencies. If a java-virtual provided by VM is in the dependencies, VM's envfile will be also processed and since if typically includes something like:
ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH"
(for a different reason than ENV_VARS in non-VM package.env), PATH will be redefined to something like:
export JAVA_HOME="/opt/sun-jdk-1.6.0.18";
export JDK_HOME="/opt/sun-jdk-1.6.0.18";
export JAVAC="/opt/sun-jdk-1.6.0.18/bin/javac";
export ROOTPATH="/opt/sun-jdk-1.6.0.18/bin:/opt/sun-jdk-1.6.0.18/jre/bin";
export MANPATH="/opt/sun-jdk-1.6.0.18/man";
export PATH="/opt/sun-jdk-1.6.0.18/bin:/opt/sun-jdk-1.6.0.18/jre/bin";
export LDPATH="/opt/sun-jdk-1.6.0.18/jre/lib/amd64/:/opt/sun-jdk-1.6.0.18/jre/lib/amd64/native_threads/:/opt/sun-jdk-1.6.0.18/jre/lib/amd64/xawt/:/opt/sun-jdk-1.6.0.18/jre/lib/amd64/server/";

which doesn't include /usr/bin
Comment 6 Alistair Bush (RETIRED) gentoo-dev 2010-03-06 04:06:55 UTC
Committed revision 8116.
Comment 7 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2010-04-28 19:46:26 UTC
Released in 2.1.11