Tom G. Christensen wrote: > + rm -f t-select-in.tmp > + ./test-select-fd r 0 t-select-in.tmp > + cat t-select-in.tmp > + test 0 = 1 > + exit 1
Thanks. So apparently Solaris 2.6 has a problem with select() of /dev/null. I verified that the test passes on Solaris 7. It's probably not worth working around it. I'm only adding a mention of it to the documentation. 2008-12-20 Bruno Haible <br...@clisp.org> * doc/posix-functions/select.texi: Mention Solaris 2.6 bug with /dev/null. * tests/test-select-in.sh: Likewise. *** doc/posix-functions/select.texi.orig 2008-12-20 20:42:10.000000000 +0100 --- doc/posix-functions/select.texi 2008-12-20 20:40:59.000000000 +0100 *************** *** 28,33 **** --- 28,37 ---- On BeOS, @code{select} can only be called on descriptors created by the @code{socket} function, not on regular file descriptors. @item + On Solaris 2.6 and older, @code{select} applied to a file descriptor opened + for reading and associated with @code{/dev/null} hangs, waiting for input, + when instead it should return immediately. + @item On Linux, when some file descriptor refers to a regular file, @code{select} may fail, setting @code{errno} to @code{EBADF}. @end itemize *** tests/test-select-in.sh.orig 2008-12-20 20:42:10.000000000 +0100 --- tests/test-select-in.sh 2008-12-20 20:38:34.000000000 +0100 *************** *** 1,6 **** --- 1,9 ---- #!/bin/sh # Test select() on file descriptors opened for reading. + # This test is known to fail on Solaris 2.6 and older, due to its handling + # of /dev/null. + tmpfiles="" trap 'rm -fr $tmpfiles' 1 2 3 15 *************** *** 23,28 **** --- 26,32 ---- test `cat t-select-in.tmp` = "1" || exit 1 # Special files. + # This part of the test is known to fail on Solaris 2.6 and older. rm -f t-select-in.tmp ./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null