Hi,

we've found that in ksh script last process is sometimes executed in background, not foreground. The odd is we were able to reproduce it only with 'su' command so far. Also this happens only with ksh 2010-06-21 and newer. ksh 2010-05-27 works fine.

Reproducer just executes what it gets as argument (some pipe operation is required to trigger the issue), in this case the 'su' command which runs 'sleep 1'. In some cases, it's run in background, so it finishes immediately and does not wait for sleep.

wrapper.sh:
#!/bin/ksh
#some pipe&subshell operation is required
export DT=`date | grep -v foo | sed 's/ /_/g'`
exec $*

sleep.sh
#!/bin/sh
echo sleeping
sleep 1

on command line:
I=0;while true; do echo $I; START=$SECONDS; ./wrapper.sh su root -c "./sleep.sh" ; ((I+=1)); ; [ $((SECONDS-START)) != 0 ] || break; done

It usually reproduces problem within 100 iterations.

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

Reply via email to