#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 ------------------------------------------------+------------------------ Reporter: mevenson | Owner: Type: defect | Status: new Priority: major | Milestone: 1.5.0 Component: interpreter | Version: 1.4.0 Keywords: cffi sys:run-progrom java-5 java-6 | Parent Tickets: ------------------------------------------------+------------------------ In chasing down the errors with CFFI on CL-TEST-GRID <https://mailman .common-lisp.net/pipermail/armedbear-devel/2016-October/003719.html>, I have found that the [java.lang.ProcessBuilder$Redirect][] interface used by Elias and Olof to extend SYS:RUN-PROGRAM for different types of I/O abstractions was introduced with Java 7, and will hence not work on earlier Java implementations.
[java.lang.ProcessBuilder$Redirect]: https://docs.oracle.com/javase/8/docs/api/java/lang/ProcessBuilder.Redirect....
Invoking ABCL-ASDF:ENSURE-MVN-VERSION, the following form causes the error {{{ (JFIELD "java.lang.ProcessBuilder$Redirect" "INHERIT") }}}
TODO: investigate the Java 6 APIs to see if there is a way to do I/O redirection with backwards compatibility. I currently suspect that there is no way to support Java 5/6 for this usage, which is why we never implemented I/O redirection previously.
There is undoubtedly a way re-write the SYS:RUN-PROGRAM interface so that we may invoke a process to read its output as a string in Java 5/Java 6, as it worked before. But we will have to figure out a way to advertise the different features of SYS:RUN-PROGRAM depending on the hosting VM.
Longer term, we may want to deprecate Java 5/6, but I would really have the compiler emit Java 7-compatible bytecode (mainly by passing the Java 6 verification process) before we begin that.
-- Ticket URL: http://abcl.org/trac/ticket/422 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson | Type: defect | Status: new Priority: major | Milestone: 1.5.0 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-progrom java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
Comment (by mevenson):
Current thinking on resolution of issue:
1. Un-deprecate SYS:RUN-SHELL-COMMAND. Use the pre Java 7 APIs as best we can to support invoking programs.
2. Re-code the SYS:RUN-PROGRAM Java callsite linkages so that ABCL may be compiled on pre-Java7 JDKs. Produce an intelligible error if it is invoked on a pre-Java7 JVM.
3. Create an API to determine runtime JVM version. Wrap UIOP/RUN-PROGRAM invocation in some sort of handler that will "fall back" to using SYS:RUN- SHELL-COMMAND if it has compatible behavior via specified args. This will potentially be fairly ugly code ASDF-side so we might provide a shim that UIOP/RUN-PROGRAM invokes that contains the logic outside the ASDF code base.
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:1 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson | Type: defect | Status: new Priority: major | Milestone: 1.5.0 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-progrom java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
Comment (by mevenson):
The attached patch restores compilation under JDK6.
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:2 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson | Type: defect | Status: new Priority: major | Milestone: 1.5.0 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-progrom java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
Comment (by mevenson):
After further analysis, the new plan of attack:
1. Continue to deprecate SYS:RUN-SHELL-COMMAND, as the JVM-[56] actually seem to provide all the behavior we need.
2. Fully support the current signature of the abcl-1.5.0-dev SYS:RUN- PROGRAM as extended by Pipping and Olof. The environment clearing/setting will work without alterations. "All that is needed" is to create an {{{org.abcl.util.AsyncIOManager}}} using the non-blocking file descriptor framework in {{{java.jnio}}} (introduced in JVM5) to drain/fill input/output {{{org.armedbear.lisp.Stream}}} instances. Pipping has collected a thorough test suite for the SYS:RUN-PROGRAM behavior, which will be of great use in implementation.
The use of {{{SYS:RUN-PROGRAM}}} as invoked by {{{UIOP/RUN-PROGRAM}}} as the implementation interface
TODO: transcribe details of SYS:RUN-PROGAM test suite invocation; implement {{{ASyncIOManager}}}.
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:3 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: assigned Priority: blocker | Milestone: 1.4.1 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-progrom java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------ Changes (by mevenson):
* owner: => mevenson * priority: major => blocker * status: new => assigned * milestone: 1.5.0 => 1.4.1
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:4 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: assigned Priority: blocker | Milestone: 1.4.1 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-program java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------ Changes (by epipping):
* cc: epipping (added) * keywords: cffi sys:run-progrom java-5 java-6 => cffi sys:run-program java-5 java-6
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:5 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: assigned Priority: blocker | Milestone: 1.4.1 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-program java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
Comment (by mevenson):
When using development versions of ABCL, [ASDF needs to be patched][1].
[1]: https://gitlab.common-lisp.net/asdf/asdf/merge_requests/57
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:6 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: accepted Priority: blocker | Milestone: 1.4.1 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-program java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------ Changes (by mevenson):
* status: assigned => accepted
Comment:
Plan of attack:
1) Use Java interfaces in org.abcl.java[5678] packages to mark JVM-side availablity until we get to the Java9 module system.
2) Keep SYS:RUN-SHELL-COMMAND deprecated Lisp-side; mody SYS:RUN-PROGRAM to fall back to the appropriate org.abcl.java5 interface capabilities signaling an exception if unable to emulate requested behavior
3) Test!
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:7 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 5/6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: accepted Priority: blocker | Milestone: 1.5.0 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-program java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
Comment (by mevenson):
Replying to [comment:7 mevenson]:
Plan of attack:
- Use Java interfaces in org.abcl.java[5678] packages to mark JVM-side
availablity until we get to the Java9 module system.
- Keep SYS:RUN-SHELL-COMMAND deprecated Lisp-side; mody SYS:RUN-
PROGRAM to fall back to the appropriate org.abcl.java5 interface capabilities signaling an exception if unable to emulate requested behavior
- Test!
Provide the following interfaces {{{ org.abcl.runtime.Java5 org.abcl.runtime.Java6 org.abcl.runtime.Java7 org.abcl.runtime.Java8 }}}
for which {{{ org.abcl.runtime.Available.getInstance() }}} returns something meaningful.
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:9 armedbear http://abcl.org armedbear
#422: SYSTEM:RUN-PROGRAM does not work on Java 6 --------------------------+------------------------------------------------ Reporter: | Owner: mevenson mevenson | Type: defect | Status: accepted Priority: blocker | Milestone: 1.6.0 Component: | Version: 1.4.0 interpreter | Resolution: | Keywords: cffi sys:run-program java-5 java-6 Parent Tickets: | --------------------------+------------------------------------------------
-- Ticket URL: http://abcl.org/trac/ticket/422#comment:11 armedbear http://abcl.org armedbear
armedbear-ticket@common-lisp.net