Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 406873 - dev-java/groovy - java.io.IOException: Cannot run program "sh": java.io.IOException: error=2, No such file or directory (incomplete PATH)
Summary: dev-java/groovy - java.io.IOException: Cannot run program "sh": java.io.IOExc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on: 451998
Blocks:
  Show dependency tree
 
Reported: 2012-03-04 11:56 UTC by Benedikt Waldvogel
Modified: 2013-01-25 19:19 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 Benedikt Waldvogel 2012-03-04 11:56:41 UTC
java.io.IOException: Cannot run program "sh": java.io.IOException: error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
	at java.lang.Runtime.exec(Runtime.java:593)
	at java.lang.Runtime.exec(Runtime.java:466)
	at jline.UnixTerminal.exec(UnixTerminal.java:292)
	at jline.UnixTerminal.exec(UnixTerminal.java:277)
	at jline.UnixTerminal.stty(UnixTerminal.java:268)
	at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:71)
	at jline.Terminal.setupTerminal(Terminal.java:75)
	at jline.Terminal.getTerminal(Terminal.java:26)
	at jline.ConsoleReader.<init>(ConsoleReader.java:174)
	at jline.ConsoleReader.<init>(ConsoleReader.java:169)
	at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:221)
	at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:185)
	at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:174)
	at groovy.ui.InteractiveShell.main(InteractiveShell.java:91)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
	at java.lang.ProcessImpl.start(ProcessImpl.java:65)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
	... 14 more
Groovy Shell (1.8.5, JVM: 1.6.0_31)
Comment 1 Benedikt Waldvogel 2012-03-04 12:09:13 UTC
reason seems to be that /bin/sh is needed but PATH is set to the JVM directories only:

gjl --package groovy --get-args
[…]
export PATH="/opt/sun-jdk-1.6.0.31/bin:/opt/sun-jdk-1.6.0.31/jre/bin";
Comment 2 Wolfgang Liebich 2012-07-17 04:10:31 UTC
I can confirm the existence of this bug also for the 32-bit x86 platform.

Is there any workaround/fix for this problem? I do not know java-config well enough...

Mr. Waldvogel has identified the problem correctly -- running groovysh under strace shows that groovysh tries to exec the shell "sh" and fails:

[pid 25169] execve("/opt/sun-jdk-1.6.0.31/bin/sh", ["sh", "-c", "stty -g < /dev/tty"], [/* 73 vars */]) = -1 ENOENT (No such file or directory)
[pid 25169] execve("/opt/sun-jdk-1.6.0.31/jre/bin/sh", ["sh", "-c", "stty -g < /dev/tty"], [/* 73 vars */]) = -1 ENOENT (No such file or directory)
Comment 3 Alistair Bush (RETIRED) gentoo-dev 2012-07-17 09:04:11 UTC
What version of java-config and groovy are you running?

When I run gjl --package groovy --get-args

I have the following output

export PATH="/opt/icedtea-bin-7.2.2.1/bin:/opt/icedtea-bin-7.2.2.1/jre/bin:${PATH}"; PATH=${PATH%:};

Thanks.
Comment 4 Benedikt Waldvogel 2012-07-18 10:19:14 UTC
groovy: 1.7.5
java-config: 2.1.11-r3
JVM: dev-java/sun-jdk 1.7.0.5-r1

gjl --package groovy --get-args
[…]
export PATH="/opt/oracle-jdk-bin-1.7.0.5/bin:/opt/oracle-jdk-bin-1.7.0.5/jre/bin";
[…]
Comment 5 Ivan Baidakou (dmol) 2012-09-29 11:35:54 UTC
I confirm the issue existence.

$gjl --package groovy --get-args | grep PATH
export ROOTPATH="/opt/sun-jdk-1.6.0.35/bin:/opt/sun-jdk-1.6.0.35/jre/bin";
export MANPATH="/opt/sun-jdk-1.6.0.35/man";
export PATH="/opt/sun-jdk-1.6.0.35/bin:/opt/sun-jdk-1.6.0.35/jre/bin";
export LDPATH="/opt/sun-jdk-1.6.0.35/jre/lib/amd64/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/native_threads/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/xawt/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/server/";

$java-config --version
Java Configuration Utility Version 2.1.11
Comment 6 Ivan Baidakou (dmol) 2012-10-21 18:57:45 UTC
I have modified the file /usr/share/java-config-2/vm/sun-jdk-1.6 by changing PATH variable to:

PATH="${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:/bin:/usr/bin"

And now the annoying error message has vanished.

Is it correct? Is it bug in sun-jdk-1.6 ?
Comment 7 Ivan Baidakou (dmol) 2012-10-21 19:48:56 UTC
Updating to dev-java/java-config-2.1.12 solves the issue. No manual changes in jvm's env are required.
Comment 8 Andrew Bovill 2013-01-20 19:16:28 UTC
(In reply to comment #7)
> Updating to dev-java/java-config-2.1.12 solves the issue. No manual changes
> in jvm's env are required.

This does indeed seem to fix the issue on my system also
Comment 9 Ralph Sennhauser (RETIRED) gentoo-dev 2013-01-21 15:32:23 UTC
With java-config-2.1.12 stable this should be fixed. Thanks for the report and testing.
Comment 10 Benedikt Waldvogel 2013-01-25 19:19:14 UTC
confirmed. thanks.