On Wed, 2012-04-25 at 08:40:49 +0200, Niels Thykier wrote:
> On 2012-04-23 23:03, Guillem Jover wrote:
> > While rebuilding packages for the new libbsd 0.4.0 upload, this package
> > fails to build consistently on at least my system, and it might seem
> > like on at least the mips buildd too, I've not investigated in detail
> > what exactly is triggering this only on these systems and not others,
> > but I think it's due to me having 3 network interfaces (lo, eth0, wlan0),
> > in any case there's a bogus fflush() on an input stream which is causing
> > wrong subsequent fseek()s. The behaviour of fflush() in input streams is
> > not usually well defined and in this case is not really needed, fseek()
> > should just do fine.
> > 
> > Attached a patch fixing this. And here's the failure mode:

> I must admit I am a bit confused.  The fflush code is in the src/Linux
> part and according to [1] fflush should be well defined on Linux.  So I
> do not immediately see why the fflush should be removed from there.
> 
> Also, libbsd is only used when building on (k)FreeBSD, in that case
> src/FreeBSD will be used as I understand the makefile[2] (and its
> network.c does not have the fflush call).  So I do not see how removing
> the fflush call in src/Linux will help in this case either.

Yes, sorry for the confusing report. I only noticed libbsd was only being
used on GNU/kFreeBSD after having built and fixed this on GNU/Linux
(that's what happens when one just brute force rebuilds...).

> Then there is the test error. "Cannot allocate memory" suggests a ENOMEM
> or so is returned, but I do not see a code path in
> sa_reset__netinterfaces() for Linux that could return ENOMEM.  On the
> other hand sa_reset_net_interfaces on (k)FreeBSD has such a return (line
> 76).

The error comes from sa_get_net_interfaces_ids() in the test case, because
it reads more than requested (due to the bogus stream state) so
"i == dst_size".

This is caused by the previous sa_reset_net_interfaces() call.

> My primary concern here is that I will be unable to convince upstream
> why this patch is correct/needed.

> [1] http://linux.die.net/man/3/fflush
> 
> """
> For input streams, fflush() discards any buffered data that has been
> fetched from the underlying file, but has not been consumed by the
> application. [...]
> 
> The standards do not specify the behavior for input streams. Most other
> implementations behave the same as Linux.
> """

Right, that's why I mentioned that I've not investigated why this is
triggering exactly, but in any case the fflush() is completely
unneeded and in this case is causing real problems as mentioned
before, while fseek() should be enough for what's needed here.

I've just tested this on mips (gabrielli) and it fixed the FTBFS there
too, but I've not digged the different error condition (ENODEV), but
I guess it's just different bogus stream state, which makes
sa_get_net_interface() not be able to find the correct entry if it's
past it.

thanks,
guillem



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to