what in the example code prints "bang"?

On Mon, 29 Mar 2010 11:08:37 +0200 Dr. Werner Fink wrote:
> I've just become owner of a bug report reporting a flaky behaviour
> in handling traps on SIGCHLD.  For a simply test see

>  ksh> echo ${sh.version}
>  Version JM 93t+ 2010-02-14
>  ksh> trap "" CHLD
>  let n=0; for d in $(seq 1 200); do if echo foo | grep bar; then echo oops 
> $((n++)); fi; done
>  bang 0
>  [...]
>  bang 177
>  ksh>

> and repeating the loop results in different numbers of reports
> showing that there is a race as there should no report at all.

> Beside this setting the trap to something not empty works like

>  ksh> trap ";" CHLD
>  let n=0; for d in $(seq 1 200); do if echo foo | grep bar; then echo oops 
> $((n++)); fi; done
>  ksh>

> which is very strange.  It is very common to use an
> empty string for traps used for ignoring signals, though.

>        Werner

> -- 
>   "Having a smoking section in a restaurant is like having
>           a peeing section in a swimming pool." -- Edward Burr
> _______________________________________________
> ast-users mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-users

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to