On Mon, Jun 24, 2013 at 3:02 PM, Roland Mainz <[email protected]> wrote:
> The following testcase shows that ast-ksh.2013-06-13 looses signals
> (or better: Doesn't call the matching SIGRTMIN and SIGCHLD traps) when
> the "sleep" builtin is used within the "wait"-loop:
> -- snip --
> function add_var
> {
>         nameref n1=$1
>         nameref n2=$2
>         (( n1+=n2 ))
> }
>
> function main
> {
>         integer -r numchildren=256
>         integer num_sigchld=0
>         integer num_sigrtmin=0
>         integer i
>         typeset jl
>         bool success=true
>
>         trap 'add_var num_sigrtmin .sh.sig.value' RTMIN+0
>         trap 'add_var num_sigrtmin .sh.sig.value' RTMIN+1
>         trap 'add_var num_sigrtmin .sh.sig.value' RTMIN+2
>         trap 'add_var num_sigrtmin .sh.sig.value' RTMIN+3
>         trap 'add_var num_sigchld .sh.sig.status' CHLD
>
>         for (( i=0 ; i < numchildren ; i++ )) ; do
>                 pid=$$ ~/bin/ksh -c $'
>                         sleep 4
>                         kill -q 1 -s RTMIN+3 $pid
>                         kill -q 1 -s RTMIN+2 $pid
>                         kill -q 1 -s RTMIN+1 $pid
>                         kill -q 1 -s RTMIN+0 $pid
>                         exit 1
>                 ' &
>         done
>
>         while ! wait ; do
>                 # sleeping while signals arrive
>                 # triggers the bug
>                 sleep 8
>         done
>
>         jl="${ LC_ALL='C' jobs -l ; }"
>
>         if (( num_sigrtmin != 4*numchildren )) ; then
>                 (( success=false ))
>                 printf 'Expected num_sigrtmin=%d, got %d\n' \
>                         $((4*numchildren)) num_sigrtmin
>         fi
>         if (( num_sigchld != numchildren )) ; then
>                 (( success=false ))
>                 printf 'Expected num_sigchld=%d, got %d\n' \
>                         numchildren num_sigchld
>         fi
>
>         if [[ "${jl}" == *Running* ]] ; then
>                 (( success=false ))
>                 printf '# error: job list not empty:\n%s\n' \
>                         "${jl}"
>         fi
>
>         if (( success )) ; then
>                 printf '# success.\n'
>                 return 0
>         else
>                 printf '# failure.\n'
>                 return 1
>         fi
>
>         # notreached
> }
>
> main "$@"
> exit $?
> -- snip --
>
> ... the expected output would be a line with "success" but on SuSE
> 12.3/AMD64/64bit ksh93 prints:
> -- snip --
> $~/bin/ksh yyy
> Expected num_sigchld=256, got num_sigchld=221
> # failure.
> $~/bin/ksh yyy
> Expected num_sigrtmin=1024, got 303
> # failure.
> $~/bin/ksh yyy
> Expected num_sigrtmin=1024, got 275
> # failure.
> $~/bin/ksh yyy
> Expected num_sigrtmin=1024, got 304
> Expected num_sigchld=256, got 255
> # failure.
> -- snip --

Erm... ping!? Did you had time to find a patch for this issue yet ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to