Hi,

the attched scripts show that it happens randomly that the ksh
Version JM 93t+ 2010-06-21 (included all patches I know) has
a race condition.  That is that the FIFO is open for writing
before it was opened for reading.  Soemtime this cause errors
like

  ./heretest[34]: /tmp/rjp.sYkvyXVX: cannot create [Interrupted system call]
  + rm -f /tmp/rj.RxDohfHm /tmp/rjp.sYkvyXVX

sometimes it simply hand in e.g.

  strace -p 32613
  Process 32613 attached - interrupt to quit
  open("/tmp/rjp.Ei3x9ZHp", O_WRONLY|O_CREAT|O_TRUNC, 0666

I've tried to replace O_CREAT with O_NONBLOCK in case of
opening an existing FIFO in sh_open() of src/cmd/ksh93/sh/io.c
but this leads to an other error like

  open("/tmp/rjp.VUuQZEjc", O_WRONLY|O_APPEND|O_NONBLOCK|O_LARGEFILE) = -1 
ENXIO (No such device or address)

in and endless loop.  As the used stat(2) system call returns
for the repalcement of the creation flag it seems that the
FIFO will never be open on the other side for writing.

Using the bash or pdksh works flawless.

  Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
#!/bin/ksh

typeset -i i
typeset -i j=0

echo KSH ${.sh.version} -- $(rpm -q ksh)

while true
do
        let i=0

        while (( i < 1000 ))
        do
                ./heretest
                let i++
        done

        let j++
        echo Test Iteration $j
        date
done
#!/bin/ksh

trap 'rm -f $DETAIL_LOG $CHANNEL_LIMITING_PIPE' EXIT

DETAIL_LOG=$(mktemp /tmp/rj.XXXXXXXX) || exit 1
CHANNEL_LIMITING_PIPE=$(mktemp -u /tmp/rjp.XXXXXXXX) || exit 1
mknod $CHANNEL_LIMITING_PIPE p || exit 1

(/bin/ksh << END_OF_MLOAD1
echo '000000000000000000000000000000000000000000 ' > /dev/null
echo '111111111111111111111111111111111111111111 ' > /dev/null
echo '222222222222222222222222222222222222222222 ' > /dev/null
echo '333333333333333333333333333333333333333333 ' > /dev/null
echo '444444444444444444444444444444444444444444 ' > /dev/null
echo '555555555555555555555555555555555555555555 ' > /dev/null
echo '666666666666666666666666666666666666666666 ' > /dev/null
echo '777777777777777777777777777777777777777777 ' > /dev/null
echo '888888888888888888888888888888888888888888 ' > /dev/null
echo '999999999999999999999999999999999999999999 ' > /dev/null
echo '000000000000000000000000000000000000000000 ' > /dev/null
echo '111111111111111111111111111111111111111111 ' > /dev/null
echo '222222222222222222222222222222222222222222 ' > /dev/null
echo '333333333333333333333333333333333333333333 ' > /dev/null
echo '444444444444444444444444444444444444444444 ' > /dev/null
echo '555555555555555555555555555555555555555555 ' > /dev/null
echo '666666666666666666666666666666666666666666 ' > /dev/null
echo '777777777777777777777777777777777777777777 ' > /dev/null
echo '888888888888888888888888888888888888888888 ' > /dev/null
echo '999999999999999999999999999999999999999999 ' > /dev/null
cat < $CHANNEL_LIMITING_PIPE  > $DETAIL_LOG
END_OF_MLOAD1
) &

/bin/cat << END_OF_FEXP > $CHANNEL_LIMITING_PIPE
echo 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
echo 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
echo 'cccccccccccccccccccccccccccccccccccccccccc'
echo 'dddddddddddddddddddddddddddddddddddddddddd'
echo 'eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
echo 'ffffffffffffffffffffffffffffffffffffffffff'
echo 'gggggggggggggggggggggggggggggggggggggggggg'
echo 'hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh'
END_OF_FEXP

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

Reply via email to