strange behavior in sys:open-pipe
Hi again, list, In LWL 5.0.1, sys:open-pipe doesn't build the exec'd command-line correctly (or, at least, not how I would have expected it) when given a simple string. (sys:open-pipe "foo bar baz") should act like (sys:open-pipe (vector "/bin/ksh" "/bin/ksh" "-c" "foo bar baz")) but sometimes it looks like it actually runs (sys:open-pipe (vector "/bin/ksh" "foo bar baz" "-c" "foo bar baz")) The "sometimes" seems to involve using shell redirection. Test case: shell script: test-lw-pipe > #!/bin/ksh > > ( > echo '$0:' $0 > echo "args:" "$@" > ps auxww | grep -v grep | grep test-lw-pipe > echo > echo pid is $$ > ps auxww | grep -v grep | grep $$ > ) > ~/lw-shell-args BUG: Listener: > CL-USER 106 > (defparameter pipe (sys:open-pipe "test-lw-pipe a b c > /dev/null" :direction :io)) > PIPE file ~/lw-shell-args: > $0: /home/lmc/bin/test-lw-pipe > args: a b c > lmc 10122 0.0 0.1 2648 1240 pts/13 S+ 11:07 0:00 test-lw-pipe a b c > /dev/null -c test-lw-pipe a b c > /dev/null ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ??? > lmc 10123 0.0 0.0 1740 536 pts/13 S+ 11:07 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > lmc 10124 0.0 0.0 1740 336 pts/13 R+ 11:07 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > > pid is 10123 > lmc 10123 0.0 0.0 1740 536 pts/13 S+ 11:07 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c Note specifically pid 10122. Compare (EXPECTED RESULT): Listener: > CL-USER 107 > (defparameter pipe (sys:open-pipe "test-lw-pipe a b c" :direction :io)) > PIPE File ~/lw-shell-args: > $0: /home/lmc/bin/test-lw-pipe > args: a b c > lmc 10238 0.0 0.0 1736 532 pts/13 S+ 11:12 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > lmc 10239 0.0 0.0 1736 332 pts/13 R+ 11:12 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > > pid is 10238 > lmc 10238 0.0 0.0 1736 532 pts/13 S+ 11:12 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c And finally (REPRODUCED BEHAVIOR): Listener: > CL-USER 110 > (defparameter pipe (sys:open-pipe (vector "/bin/ksh" "test-lw-pipe a b c > /dev/null" "-c" "test-lw-pipe a b c > /dev/null") :direction :io)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > PIPE File ~/lw-shell-args: > $0: /home/lmc/bin/test-lw-pipe > args: a b c > lmc 10311 0.0 0.0 1740 540 pts/13 S+ 11:16 0:00 test-lw-pipe a b c > /dev/null -c test-lw-pipe a b c > /dev/null ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > lmc 10312 0.0 0.0 1740 536 pts/13 S+ 11:16 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > lmc 10313 0.0 0.0 1740 336 pts/13 R+ 11:16 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c > > pid is 10312 > lmc 10312 0.0 0.0 1740 536 pts/13 S+ 11:16 0:00 /bin/ksh /home/lmc/bin/test-lw-pipe a b c I guess my workaround is to use the list form and not the string form. I started this "bug report" because I thought the executable I was actually calling was being called incorrectly, but doing further research during the write-up made me realize that it only looks wrong in ps. Anyway, caveat user. -- Larry Clapp