ninjudd / drip

Fast JVM launching without the hassle of persistent JVMs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On FreeBSD drip does not work as a drop-in replacement for java.

josteink opened this issue · comments

Drip does not seem to pass parameters along to java correctly on FreeBSD

See following shell sessions:

 [1510][jostein@invalid:~/.m2/repository/org/clojure/clojure/1.4.0]$ ls -l
 total 3372
 -rw-r--r--  1 jostein  users      180 Oct 15 14:24 _maven.repositories
 -rw-r--r--  1 jostein  users  3421683 Oct 15 14:24 clojure-1.4.0.jar
 -rw-r--r--  1 jostein  users       40 Oct 15 14:24 clojure-1.4.0.jar.sha1
 -rw-r--r--  1 jostein  users     5420 Oct 12 20:15 clojure-1.4.0.pom
 -rw-r--r--  1 jostein  users       40 Oct 12 20:15 clojure-1.4.0.pom.sha1
 [1510][jostein@invalid:~/.m2/repository/org/clojure/clojure/1.4.0]$ drip -cp clojure-1.4.0.jar clojure.main
 expr: illegal option -- c
 usage: expr [-e] expression
 Unknown command: -cp
 [1510][jostein@invalid:~/.m2/repository/org/clojure/clojure/1.4.0]$ java -cp clojure-1.4.0.jar clojure.main
 Clojure 1.4.0
 user=>

What version of bash is installed?

On Nov 23, 2012, at 6:14 AM, josteink notifications@github.com wrote:

Drip does not seem to pass parameters along to java correctly on FreeBSD

See following shell sessions:

[1510][jostein@invalid:/.m2/repository/org/clojure/clojure/1.4.0]$ ls -l
total 3372
-rw-r--r-- 1 jostein users 180 Oct 15 14:24 _maven.repositories
-rw-r--r-- 1 jostein users 3421683 Oct 15 14:24 clojure-1.4.0.jar
-rw-r--r-- 1 jostein users 40 Oct 15 14:24 clojure-1.4.0.jar.sha1
-rw-r--r-- 1 jostein users 5420 Oct 12 20:15 clojure-1.4.0.pom
-rw-r--r-- 1 jostein users 40 Oct 12 20:15 clojure-1.4.0.pom.sha1
[1510][jostein@invalid:
/.m2/repository/org/clojure/clojure/1.4.0]$ drip -cp clojure-1.4.0.jar clojure.main
expr: illegal option -- c
usage: expr [-e] expression
Unknown command: -cp
[1510][jostein@invalid:~/.m2/repository/org/clojure/clojure/1.4.0]$ java -cp clojure-1.4.0.jar clojure.main
Clojure 1.4.0
user=>

Reply to this email directly or view it on GitHub.

See following output:

[1222][jostein@invalid:~]$ bash --version
bash --version
GNU bash, version 4.2.37(0)-release (i386-portbld-freebsd7.4)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

I've inspected the environment and it seems (which seems to match my memory) that FreeBSD does not ship with bash out of the box, and that this is built from source via the ports-system. /usr/bin/env bash, resolves to "bash", which only occurance is in /usr/local/bin/bash.

Looking into this one a little bit more myself, it seems like the issue is with the expr-binary, I find that what works on my Raspberry Pi running Raspbian (Debian-based Linux) does not work on FreeBSD.

Observe the following output on Raspbian:

jostein@raspberry:~$ expr "-cp" : '.*[.-]'
1
jostein@raspberry:~$ expr --version
expr (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Parker, James Youngman, and Paul Eggert.

And the following on FreeBSD:

[1300][jostein@invalid:~]$ expr "-cp" : '.*[.-]'
expr: illegal option -- c
usage: expr [-e] expression

"-cp" is taken as an option to expr. Doing the following to prevent this however, seems to trigger same behaviour as in GNU expr:

[1301][jostein@invalid:~]$ expr -- "-cp" : '.*[.-]'
1

Replacing all occurances of "expr" with "expr --" in the drip script seems to fix the error on FreeBSD:

[1302][jostein@invalid:~/.m2/repository/org/clojure/clojure/1.4.0]$ drip -cp clojure-1.4.0.jar clojure.main
Clojure 1.4.0
user=>

Same modified script tested on Raspberry Pi running Linux:

jostein@raspberry:~$ drip -cp clojure-1.4.0.jar clojure.main
Clojure 1.4.0
user=>

Seems like we have a simple fix :)

Thanks for tracking this down!