Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 269169 - dev-lang/scala-2.7.4-r1 overquotes scala.home in wrapper scripts
Summary: dev-lang/scala-2.7.4-r1 overquotes scala.home in wrapper scripts
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-09 18:04 UTC by David Brown
Modified: 2009-06-05 08:46 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 David Brown 2009-05-09 18:04:44 UTC
The shell wrapper scripts for scala (scala, scalac, fsc, scaladoc) attempt to set the java property scala.home as part of gjl_java_args.  The script seems to be trying to quote the pathname given, but the quotes are sometimes taken directly rather than interpreted as quotes.

This is especially noticeable with 'fsc', causing it to generate a directory called '"/usr/share/scala' (the first path component being a directory named double quote) in the current directory.

Reproducible: Always

Steps to Reproduce:
1. run: 'fsc'
Could not connect to compilation daemon.
2. ls
Directory named " present
3. pgrep java
The fsc is actually running.
Actual Results:  
Daemon runs, but creates it's state file in a directory starting with a doublequote.

Expected Results:  
fsc should try creating the socket description file in /usr/share/scala, realize it doesn't have permissions, and then create the file in the user's home direcotry.

Portage 2.1.6.13 (default/linux/amd64/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.29.2 x86_64)
=================================================================
System uname: Linux-2.6.29.2-x86_64-Intel-R-_Xeon-R-_CPU_5150_@_2.66GHz-with-glibc2.2.5
Timestamp of tree: Fri, 08 May 2009 05:00:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-python/pycrypto: 2.0.1-r8
dev-util/cmake:      2.6.2-r1
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages metadata-transfer parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j5 --load-average=3"
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="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/vmware"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam firefox fortran gdbm gif gnome gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg kde ldap libnotify mad midi mikmod mmx mp3 mpeg mudflap multilib ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis xml xorg xulrunner xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="vmware vesa fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 José Romildo Malaquias 2009-05-12 11:58:01 UTC
As a symptom of this, when a scala application is run, it fails because it cannot find any Scala library.

For instance, when compiling and running the program Hello.scala:

   object Hello {
     def main(args: Array[String]) {
       println("Hello!");
     }
   }


$ scalac Hello.scala

$ scala Hello
no such file: Hello

$ scala -cp . Hello
java.lang.NoClassDefFoundError: scala/ScalaObject
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	at Hello.main(Hello.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at scala.tools.nsc.ObjectRunner$$anonfun$run$1.apply(ObjectRunner.scala:75)
	at scala.tools.nsc.ObjectRunner$.withContextClassLoader(ObjectRunner.scala:49)
	at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:74)
	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:154)
	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	... 21 more

If the quotes are removed from the definition of scala.home in the /usr/bin/scala script, things get better:

$ scala Hello
no such file: Hello

$ scala -cp . Hello
Hello!


But the scala script still behaves differently from the one in the distribution, which does not requires "-cp ." in order to find the class in the current directory:

$ /opt/scala/scala-2.7.4.final/bin/scala Hello
Hello!
Comment 2 Petteri Räty (RETIRED) gentoo-dev 2009-05-17 12:01:43 UTC
I tried reproducing this but couldn't:
betelgeuse@pena ~/test $ fsc Hello.scala
betelgeuse@pena ~/test $

betelgeuse@pena ~/test $ scalac Hello.scala
betelgeuse@pena ~/test $ scala Hello
Hello!
Comment 3 Petteri Räty (RETIRED) gentoo-dev 2009-05-17 12:02:26 UTC
please post the output of java -version to see what VM you are using
Comment 4 David Brown 2009-05-17 20:08:50 UTC
$ java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
$ equery l sun-jdk
[ Searching for package 'sun-jdk' in all categories among: ]
 * installed packages
[I--] [  ] dev-java/sun-jdk-1.6.0.13 (1.6)

It also is important to not have USE=binary in the scala install.
Comment 5 Petteri Räty (RETIRED) gentoo-dev 2009-05-20 22:40:46 UTC
(In reply to comment #4)
> 
> It also is important to not have USE=binary in the scala install.
> 

My best guess is that this could be bash version related. I am on 4.0. Maybe this only manifests with 3.2*. If you want to test, please upgrade to 4.0 and report it if fixes it, otherwise I will try to find someone with 3.2* to install scala and test.
Comment 6 David Brown 2009-05-21 00:18:52 UTC
I upgraded to bash app-shells/bash-4.0_p24, re-emerged scala, and still have exactly the same problem.
Comment 7 Alistair Bush (RETIRED) gentoo-dev 2009-05-31 13:52:13 UTC
(In reply to comment #6)
> I upgraded to bash app-shells/bash-4.0_p24, re-emerged scala, and still have
> exactly the same problem.
> 

I have also confirmed this.
Comment 8 Alistair Bush (RETIRED) gentoo-dev 2009-06-02 10:49:14 UTC
(In reply to comment #1)
> But the scala script still behaves differently from the one in the
> distribution, which does not requires "-cp ." in order to find the class in the
> current directory:
> 
> $ /opt/scala/scala-2.7.4.final/bin/scala Hello
> Hello!
> 

This is expected. We do not add the current directory to the CLASSPATH as it could result in unexpected results.  The Gentoo Java User guide suggests that you set CLASSPATH=. in your environment, if that is what you wish.

$ CLASSPATH=. GJL_DEBUG=true scala Hello
Calling: gjl --package scala --get-args --get-vm
Using:
Running: exec java  -classpath .:/usr/share/jline/lib/jline.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scala-swing.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-compiler.jar -Djava.library.path=/lib:/usr/lib -Xmx256M -Xms32M -Dscala.home=/usr/share/scala -Denv.emacs= scala.tools.nsc.MainGenericRunner  Hello
Hello, world!
alistair@LINUX ~/gentoo/tmp $ GJL_DEBUG=true scala Hello
Calling: gjl --package scala --get-args --get-vm
Using:
Running: exec java  -classpath /usr/share/jline/lib/jline.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scala-swing.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-compiler.jar -Djava.library.path=/lib:/usr/lib -Xmx256M -Xms32M -Dscala.home=/usr/share/scala -Denv.emacs= scala.tools.nsc.MainGenericRunner  Hello
no such file: Hello
Comment 9 Alistair Bush (RETIRED) gentoo-dev 2009-06-05 08:46:18 UTC
committed 2.7.5 and removed quotes so closing this issue.