The latest ksh alpha has a problem with the following script:

========================================
$ cat bug.sh
producer() {
  for ((i = 0; i < 10000; i++ ))
  do
    print ${i}
  done
}

consumer() {
  while read var
  do
    print ${var}
  done < ${1}
}

consumer <(producer)
========================================

If the script is run using the default ksh on OS X 10.8, it runs to completion:
========================================
$ ksh --version
  version         sh (AT&T Research) 93u 2011-02-08
$ ksh bug.sh | tail
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
$
========================================

However, on an OS X 10.6 host using the latest ksh alpha, the script hangs.
Running with xtrace, it appears that the hang occurs after 3499 iterations of
the "for" loop:
========================================
$ ksh --version
  version         sh (AT&T Research) 93v- 2013-10-08
$ ksh -x ./bug.sh
+ consumer /dev/fd/3
+ 0< /dev/fd/3
+ read var
+ producer
+ ((i = 0))
+ (( i < 10000))
+ print 0
+ ((i++ ))
+ (( i < 10000))
+ print 1
...
+ ((i++ ))
+ (( i < 10000))
+ print 3499
========================================

--
Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
http://weeks.public.iastate.edu/
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to