Bug #14217
closed
shbin and java exec modules do not work after 6826
Added by Andy Fiddaman 7 months ago.
Updated 7 months ago.
Description
build% echo echo hello > /tmp/bob
build% shcomp /tmp/bob > /tmp/bobby
build% chmod +x /tmp/bobby
build% /tmp/bobby
/usr/bin/amd64/ksh93: H^A: not found [No such file or directory]
- Related to Feature #6826: want support for nested interpreters added
- Related to Bug #13996: ksh testsuite failures added
What's going on here is that, in adding support for nested interpreters, #6826 changed the intp_name
and intp_arg
members of struct intpdata
from a single pointer to an array, in order to support recursive calls. This array should be terminated with a NULL pointer so that stk_copyin()
knows when to stop but the shbin and java exec modules allocate this from the stack and only assign to the first array element.
Testing:
bloody% cat test.ksh
print "Args: $@"
bloody% shcomp test.ksh >| test
bloody% chmod +x test
bloody% ./test `seq 1 5`
Args: 1 2 3 4 5
For java, I also had to patch the module for the jexec location on OmniOS, but having done that, with this small test program:
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
public class test {
public static String url = "https://omnios.org/";
public static void main(String[] args) throws IOException{
String version = System.getProperty("java.version");
System.out.println("Runtime version: " + version);
URLConnection conn = new URL(test.url).openConnection();
conn.connect();
System.out.println("Connected to " + test.url);
}
}
bloody% /usr/jdk/instances/openjdk1.8.0/bin/javac test.java
bloody% jar cvfe test.jar test test.class
added manifest
adding: test.class(in = 1055) (out= 599)(deflated 43%)
bloody%
bloody% chmod +x test.jar
bloody% ./test.jar
Runtime version: 1.8.0_312
Connected to https://omnios.org/
Also, with this fix in place, a previously failing test from the ksh93 test suite now passes.
% export SHELL=/usr/bin/amd64/ksh93
% export SHCOMP=/usr/bin/shcomp
% cd /opt/ksh93-tests
% $SHELL shtests tests/sun_solaris_cr_6862121_shbinexec_kernel_module_defunct.sh
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct begins at 2021-11-05+11:05:55
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct passed at 2021-11-05+11:05:55 [ 7 tests 0 errors ]
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct(C.UTF-8) begins at 2021-11-05+11:05:55
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct(C.UTF-8) passed at 2021-11-05+11:05:55 [ 7 tests 0 errors ]
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct(shcomp) begins at 2021-11-05+11:05:55
test sun_solaris_cr_6862121_shbinexec_kernel_module_defunct(shcomp) passed at 2021-11-05+11:05:55 [ 7 tests 0 errors ]
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
git commit 4fd0933306bf532a1642c8821ccc6e886949df54
commit 4fd0933306bf532a1642c8821ccc6e886949df54
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date: 2021-11-05T14:27:17.000Z
14217 shbin and java exec modules do not work after 6826
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Also available in: Atom
PDF