Thanks, David---that patch fixed the problem.

--
Nathan Weeks
IT Specialist
USDA-ARS Corn Insects and Crop Genetics Research Unit
http://weeks.public.iastate.edu/


On Wed, Jan 29, 2014 at 5:23 PM, David Korn <[email protected]> wrote:
> Thanks for reporting the problem.  Code had been added for some necessary
> synchronization which caused the bug.  I have included a on line patch to
> sh/xec.c which will fix your case without breaking any regression tests.
> However, I think that I could concoct a case that could hang, so I might
> have to revisit this logic in the future.  Anyway, try the following patch
> and let me know if the problem is fixed.  The patch will be in the next
> ksh93 beta update.
>
> --- old/sh/xec.c Mon Nov 18 06:52:01 2013
> +++ new/sh/xec.c Wed Jan 29 14:53:10 2014
> @@ -2965,7 +2965,7 @@
>   break;
>      }
>   }
> - if(shp->procsub && *shp->procsub)
> + if(shp->procsub && *shp->procsub && t && t->com.comtyp==(COMSCAN|TCOM))
>   {
>   pid_t pid, *procsub;
>   int exitval = shp->exitval;
>
>
>
>
>
> On Wed, Jan 29, 2014 at 2:36 PM, Nathan Weeks <[email protected]> wrote:
>>
>> 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
>
>
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to