Re: interix 3.5 select bug

2009-03-16 Thread Simon Josefsson
Bruno Haible writes: > Here is a series of two proposed patches to provide a workaround. > Simon, is that OK to commit? I am back from vacation now. Yes, that looks fine, but I haven't tested it. Thanks for working on it. It will get tested by me eventually, after the next --import run. /Sim

Re: interix 3.5 select bug

2009-03-13 Thread Bruno Haible
Jim Meyering wrote: > > select (0, rfds, wfds, xfds, timeout) is supposed to be equivalent to > > select (0, NULL, NULL, NULL, timeout) and supposed to be equivalent to > > select (n, NULL, NULL, NULL, timeout) for any n > 0. ... > > I agree. OK, I committed the patch. Bruno

RE: interix 3.5 select bug

2009-03-13 Thread Markus Duft
> > Jim Meyering wrote: > > > + /* Interix 3.5 has a bug: it does not support nfds == 0. */ > > > + if (nfds == 0) > > > +{ > > > + nfds = 1; > > > + rfds = NULL; > > > + wfds = NULL; > > > + xfds = NULL; > > > +} > > > > Did you consider doing the above only when al

Re: interix 3.5 select bug

2009-03-13 Thread Jim Meyering
Bruno Haible wrote: > Jim Meyering wrote: >> > + /* Interix 3.5 has a bug: it does not support nfds == 0. */ >> > + if (nfds == 0) >> > +{ >> > + nfds = 1; >> > + rfds = NULL; >> > + wfds = NULL; >> > + xfds = NULL; >> > +} >> >> Did you consider doing the above only

Re: interix 3.5 select bug

2009-03-12 Thread Bruno Haible
Jim Meyering wrote: > > + /* Interix 3.5 has a bug: it does not support nfds == 0. */ > > + if (nfds == 0) > > +{ > > + nfds = 1; > > + rfds = NULL; > > + wfds = NULL; > > + xfds = NULL; > > +} > > Did you consider doing the above only when all three input pointers >

Re: interix 3.5 select bug

2009-03-12 Thread Jim Meyering
Bruno Haible wrote: > Simon Josefsson wrote: >> > It seems that another solution would be to >> > detect this problem, and to replace select if the system's select >> > doesn't work. > > Good point. Using 0 as nfd argument is common; try searching for > " = select (0, " on http://www.google.com/cod

Re: interix 3.5 select bug

2009-03-12 Thread Bruno Haible
Simon Josefsson wrote: > > It seems that another solution would be to > > detect this problem, and to replace select if the system's select > > doesn't work. Good point. Using 0 as nfd argument is common; try searching for " = select (0, " on http://www.google.com/codesearch/. > I haven't studie

RE: interix 3.5 select bug

2009-03-11 Thread Markus Duft
> Pádraig Brady wrote: > > Markus Duft wrote: [snip] > > Thanks for looking at that, Pádraig. > I agree. > > Note that there are other uses of select with 0 as first argument. > These affect the poll ans select modules: > > $ git grep -l 'select (0' > lib/poll.c > lib/winsock-select.

Re: interix 3.5 select bug

2009-03-11 Thread Jim Meyering
Simon Josefsson wrote: > Jim Meyering writes: > >> +* lib/nanosleep.c (my_usleep): Use 1, not 0, as the first argument. >> +This avoids a failure on Interix 3.5. Details in >> +http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/16077 > > Is this the best solution? It seems that a

Re: interix 3.5 select bug

2009-03-11 Thread Paolo Bonzini
> > That looks fine as the first param to select > > is the highest-numbered file descriptor + 1. > > Arguably 1 is more correct than 0. I think this patch is fine. OTOH 1 is *not* more correct than 0, because it implies that fd 0 might be tested. The other uses are for WinSock only, so they sh

Re: interix 3.5 select bug

2009-03-11 Thread Simon Josefsson
Jim Meyering writes: > + * lib/nanosleep.c (my_usleep): Use 1, not 0, as the first argument. > + This avoids a failure on Interix 3.5. Details in > + http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/16077 Is this the best solution? It seems that another solution would be to de

Re: interix 3.5 select bug

2009-03-11 Thread Jim Meyering
Pádraig Brady wrote: > Markus Duft wrote: >> Hi! >> >> I have a more or less trivial patch for the nanosleep replacement for >> interix. The problem I ran into is, that select() has a bug, making it fail >> with "bad address" if the number of fd's to select on is zero. Setting the >> set-size to 1

Re: interix 3.5 select bug

2009-03-11 Thread Pádraig Brady
Markus Duft wrote: > Hi! > > I have a more or less trivial patch for the nanosleep replacement for > interix. The problem I ran into is, that select() has a bug, making it fail > with "bad address" if the number of fd's to select on is zero. Setting the > set-size to 1 solves the problem, and shou