Discussion:
[clisp-list] ext:run-program vs. ext:make-pipe-io-stream
Pascal Bourguignon
2017-03-10 21:26:39 UTC
Permalink
Hello,

I’m observing a strange difference of behavior between ext:run-program and ext:make-pipe-io-stream:

I’m opening a bidirectional pipe with a command (namely:
command = “java”
arguments = ("-Xdock:name=foo" “-classpath" "/usr/local/lib/spl.jar”
"stanford/spl/JavaBackEnd" “foo”)
) with either:

(multiple-value-list
(ext:letf ((custom:*misc-encoding* *command-encoding*)
(custom:*default-file-encoding* *jbe-encoding*))
(ext:run-program command
:arguments arguments
:wait nil
:input :stream
:output :stream)))

or:

(multiple-value-list
(ext:letf ((custom:*misc-encoding* *command-encoding*)
(custom:*default-file-encoding* *jbe-encoding*))
(ext:make-pipe-io-stream (format nil "~A ~{~A~^ ~}"
command
(mapcar (function shell-quote-argument)
arguments))
:element-type 'character
:external-format custom:*default-file-encoding*
:buffered nil)))

I immediately close the bidirectional stream (first result), and use the output and input streams. However, as soon as I write the first line and flush it with force-output, I get a
stream-error:
UNIX error 32 (EPIPE): Broken pipe, child process terminated or socket closed
when I use run-program.

On the other hand, it works correctly without any problem with make-pipe-ip-stream.


What could explain the difference?


This is on macOS Sierra.



C/USER[20]> (COM.INFORMATIMAGO.TOOLS.MANIFEST:PRINT-BUG-REPORT-INFO)


LISP-IMPLEMENTATION-TYPE "CLISP"
LISP-IMPLEMENTATION-VERSION "2.49 (2010-07-07) (built on imac.home [192.168.7.71])"
SOFTWARE-TYPE
"/usr/bin/clang -arch x86_64 -pipe -Wl,-no_pie -arch x86_64 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -O -DUNIX_BINARY_DISTRIB -DENABLE_UNICODE -DDYNAMIC_MODULES -I. -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -lintl -Wl,-framework -Wl,CoreFoundation -lreadline -lncurses -liconv -L/opt/local/lib -lsigsegv libgnu_cl.a
SAFETY=0 HEAPCODES STANDARD_HEAPCODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.10
libiconv 1.14
libreadline 6.3"
SOFTWARE-VERSION "GNU C 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)"
MACHINE-INSTANCE "despina.home [192.168.7.10]"
MACHINE-TYPE "X86_64"
MACHINE-VERSION "X86_64"
distribution (:DARWIN :APPLE "10.12.3")
uname -a "Darwin despina.home 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 i386 iMac17,1 Darwin"
*FEATURES*
(:TESTING-SCRIPT :COM.INFORMATIMAGO.PJB :CLISP-HAS-STREAM-READ/WRITE-SEQUENCE
:CLOSER-MOP :UIOP :SPLIT-SEQUENCE
:COM.INFORMATIMAGO.COMMON-LISP.LISP.CL-STEPPER :USE-REGEXP :CL-PPCRE
:NEWLINE-IS-LINEFEED :HAS-ASCII-CODE :HAS-NULL :HAS-VT :HAS-BELL :HAS-ESCAPE
:HAS-LINEFEED :HAS-RETURN :HAS-BACKSPACE :HAS-TAB :HAS-PAGE :HAS-RUBOUT
:QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX
:OS-UNIX :ASDF-UNICODE :X86 :REGEXP :SYSCALLS :I18N :LOOP :COMPILER :CLOS :MOP
:CLISP :ANSI-CL :COMMON-LISP :LISP=CL :INTERPRETER :SOCKETS :GENERIC-STREAMS
:LOGICAL-PATHNAMES :SCREEN :GETTEXT :UNICODE :BASE-CHAR=CHARACTER :WORD-SIZE=64
:UNIX :MACOS)


;;; uname -a
Darwin despina.home 16.4.0 Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64 x86_64 i386 iMac17,1 Darwin
;;; (EXT:ARGV)
#("/opt/local/lib/clisp-2.49/base/lisp.run" "-B" "/opt/local/lib/clisp-2.49" "-M" "/opt/local/lib/clisp-2.49/base/lispinit.mem" "-N" "/opt/local/share/locale")
;;; /opt/local/bin/clisp --version
GNU CLISP 2.49 (2010-07-07) (built on imac.home [192.168.7.71])
Software: GNU C 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)
/usr/bin/clang -arch x86_64 -pipe -Wl,-no_pie -arch x86_64 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -O -DUNIX_BINARY_DISTRIB -DENABLE_UNICODE -DDYNAMIC_MODULES -I. -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -lintl -Wl,-framework -Wl,CoreFoundation -lreadline -lncurses -liconv -L/opt/local/lib -lsigsegv libgnu_cl.a
SAFETY=0 HEAPCODES STANDARD_HEAPCODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.10
libiconv 1.14
libreadline 6.3
Features:
(REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL
INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN GETTEXT UNICODE
BASE-CHAR=CHARACTER WORD-SIZE=64 UNIX MACOS)
C Modules: (clisp i18n syscalls regexp)
Installation directory: /opt/local/lib/clisp-2.49/
User language: ENGLISH
Machine: X86_64 (X86_64) despina.home [192.168.7.10]

C/USER[21]>
--
__Pascal J. Bourguignon__
Sam Steingold
2017-03-13 01:19:26 UTC
Permalink
Post by Pascal Bourguignon
I’m observing a strange difference of behavior between ext:run-program
It would be nice if you could file a bug report on SF with a test case
(something I could copy/paste at the CLISP prompt and get the error or
correct output).

thanks
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 16.10 (yakkety) X 11.0.11804000
http://www.childpsy.net/ http://americancensorship.org http://think-israel.org
http://www.dhimmitude.org http://ffii.org http://camera.org
The more project management you do, the less likely your project is to succeed.
Loading...