On Wed, Dec 4, 2013 at 10:51 PM, Roland Mainz <roland.ma...@nrubsig.org> wrote: > On Wed, Dec 4, 2013 at 10:39 PM, Vladimir Marek > <vladimir.ma...@oracle.com> wrote: >> What a coincidence, I just stumbled upon another issue. I don't have fix >> for this though ... >> >> The test script: >> >> $ cat c >> #!/bin/ksh >> >> trap 'exit' EXIT >> >> ( >> yes | while read A; do >> echo "$A" >> STDERR=$(</dev/null) >> done >> ) >> >> It should write infinite number of characters 'y'. But in reality it only >> writes one 'y' and ten empty lines only. >> >> Also if you run the script as >> >> $ ./c | head >> >> It hangs. I don't know whether the two things (not reading and hanging) are >> just a single issue or two different ones. >> >> I can reproduce this on both linux and solaris. On linux the ksh says >> >> $ echo $KSH_VERSION >> Version AJM 93u+ 2012-08-01 >> >> On Solaris >> Version JM 93u 2011-02-08 >> >> I'm just having a bad luck lately I guess ... > > I can reproduce the same issue with the following reduced testcase on > Illumos B151a7/AMD64 with ast-ksh.2013-10-10/AMD64/64bit: > -- snip -- > ( > for ((;;)) ; do print y ; done | while read A; do > printf "%s\n" "$A" > STDERR=$(</dev/null) > done > ) > -- snip -- > > It seems to be an issue with the non-|fork()|'ing subshell code... if > I force the code to use |fork()| for a subshell using the ulimit(1) > builtin I get the correct output: > -- snip -- > $ cat c.sh > ( > ulimit -c 0 > > for ((;;)) ; do print y ; done | while read A; do > printf "%s\n" "$A" > STDERR=$(</dev/null) > done > ) > $ ~/bin/ksh c.sh | head > y > y > y > y > y > y > y > y > y > y > -- snip -- [snip]
Another workaround is to replace the $( < file ) construct with $( cat < file ) ... note that ${ < file } has the same issues as $( < file ) in a subshell... ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) roland.ma...@nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) _______________________________________________ ast-developers mailing list ast-developers@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-developers