[adding bug-gnulib] On 06/12/2016 03:47 PM, Rainer M. Canavan wrote: > I've noticed that updatedb has consistently failed since upgrading > to findutils 4.6.0. I'm using IRIX 6.5.30 and the mipspro compilers.
Thanks for the report. > > It turns out that frcode assumes that a write error has occurred, > although in reality everything went well, because > putc(-1, stdout) returns -1 on success _and_ failure, since > EOF == -1, and therefore in frcode.c, line 335: > > if (EOF == putc (diffcount, stdout)) > > exits with "write error". I'm not sure why this isn't always triggered > if (diffcount == -1), but I haven't checked if the same codepath is > always taken. That's a bug in IRIX putc(); POSIX is clear that putc() is supposed to cast its argument to unsigned char before writing to the stream, and then return the character just written. Gnulib should be taught to work around the bug. > > A possible fix would be to cast diffcount to unsigned char, this > appears to work (and results in a valid locatedb) on both > linux and irix: > > putc ((unsigned char)diffcount, stdout)) This workaround should be embedded in gnulib, so that findutils can continue to use putc() without the cast. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature