Project

General

Profile

Actions

Bug #14217

closed

shbin and java exec modules do not work after 6826

Added by Andy Fiddaman 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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 issues

Related to illumos gate - Feature #6826: want support for nested interpretersClosedJerry Jelinek2016-03-27

Actions
Related to illumos gate - Bug #13996: ksh testsuite failuresNew

Actions
Actions #1

Updated by Andy Fiddaman 7 months ago

  • Related to Feature #6826: want support for nested interpreters added
Actions #2

Updated by Andy Fiddaman 7 months ago

  • Related to Bug #13996: ksh testsuite failures added
Actions #3

Updated by Electric Monk 7 months ago

  • Gerrit CR set to 1780
Actions #4

Updated by Andy Fiddaman 7 months ago

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.

Actions #5

Updated by Andy Fiddaman 7 months ago

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/
Actions #6

Updated by Andy Fiddaman 7 months ago

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 ]
Actions #7

Updated by Electric Monk 7 months ago

  • 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>

Actions

Also available in: Atom PDF