[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#300640: glibc: select() buggy on Hurd



Package: glibc
Version: 2.3.2.ds1-20


Coin,

Here is a simple poll() test case :
(hurd poll() directly uses hurd_select())
<quote file="poll.c">
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/poll.h>

int main(void)
{
        struct pollfd   pfd[1];
        int             fd, ret;
        char            c;

        fd = open("zzz", O_RDONLY);
        pfd[0].fd = fd;
        pfd[0].events = POLLIN;
        while ((ret = poll(pfd, 1, 10)) >= 0)
        {
                if (ret == 0)
                        continue;
                if (pfd[0].revents & POLLERR)
                        break;
                if (pfd[0].revents & POLLIN)
                {
                        printf("DATA !\n");
                        read(fd, &c, 1);
                }
        }

        return 0;
}
</quote>

Test :
mkfifo zzz
./poll &
echo "coin" >zzz


Result on linux :
DATA !
DATA !
DATA !
DATA !
DATA !

I've got 1 "DATA !" per character (including "\n").

Result on Hurd :
DATA !
DATA !
DATA !
DATA !
DATA !
DATA !
DATA !
[...]

I've got an infinite number of "DATA !".

It is like if the select state is not reset after reading.

I tried to find the bug but i need help, this software is not an easy peace.

Thanks.

-- 
Marc Dequènes (Duck)

Attachment: pgp0lKJoISfPQ.pgp
Description: PGP signature


Reply to: