On 08/20/2010 03:00 AM, Philipp Thomas wrote: > * Paul Eggert ([email protected]) [20100819 21:28]: > >> Where is the source code that your distribution currently uses? > > The Source rpm is here: > http://software.opensuse.org/search/download?base=openSUSE%3A11.1&file=openSUSE%3A%2F11.1%2Fstandard%2Fsrc%2Fdiffutils-2.8.7-143.11.src.rpm&query=diffutils > >> http://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=b50a16567acff496bdf3ac0004809b6dcc88c2d6 > > As this basically does the same thing as my patch I'll use this. > >> By the way, this patch works around bugs in freopen on Solaris and *BSD, >> and it appears that those bugs are in SUSE too, so you might want to >> further investigate that. I don't observe similar problems in Ubuntu. > > This would be a bug in glibc then. But I don't see where the bug would be. > Freopen basically rewinds the FILE pointer which is impossible on devices > like sockets.
freopen(NULL,"wb",stdout) has implementation-defined effects. On cygwin, it is defined as forcing the file to be in binary mode (and is always safe, even on sockets). On other platforms, it may have no effects (other than rewinding the current FILE offset), or it may be an error. Basically, diff should not be calling freopen except in cases where it knows that the implementation-defined effect is desirable. The bug was that because diff was not checking whether O_BINARY was non-zero before calling freopen, that it ended up calling freopen on platforms where the effects were not defined to have the same effects as on cygwin where the call is needed. -- Eric Blake [email protected] +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
