bug-diffutils
[Top][All Lists]
Advanced

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

Re: [bug-diffutils] Funny behaviour of diff 2.8.1


From: Eric Blake
Subject: Re: [bug-diffutils] Funny behaviour of diff 2.8.1
Date: Fri, 20 Aug 2010 07:38:45 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1

On 08/20/2010 03:00 AM, Philipp Thomas wrote:
> * Paul Eggert (address@hidden) [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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]