[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn 1.4.5 bug with diff on binary files

From: Wade Carpenter <wade.carpenter_at_gmail.com>
Date: 2007-08-30 02:28:06 CEST

Hi Ben,

Thanks for the reply.

I was actually able to reproduce the problem on 1.4.2. I built 1.4.5
to check the latest release as well, which I configured with
--enable-maintainer-mode --disable-shared, so I think I just ran the
wrong 'svn' binary to retrieve the version =)

I looked at the diff.c and it needs both the old and new fles to have
no svn:mime-type property. It's obviously not a smart thing to have
for binary files, but the behaviour is different between internal diff
and external diff for this case.

Here's what I did (with diff-cmd=/usr/bin/diff):

$ svn --version
svn, version 1.4.5 (r25188)
  compiled Aug 29 2007, 14:59:42
$ dd if=/dev/urandom of=test.bin count=5
$ svn add test.bin
A (bin) test.bin
$ svn pd svn:mime-type test.bin
property 'svn:mime-type' deleted from 'test.bin'.
$ svn ci -m "..." test.bin
Adding test.bin
Transmitting file data .
Committed revision 12470.
$ svn st test.bin
$ dd if=/dev/urandom of=test.bin count=5
$ svn diff test.bin
Index: test.bin
===================================================================
Binary files test.bin (revision 12470) and test.bin (working copy) differ
../svn_1.4.5/subversion/libsvn_subr/io.c:2230: (apr_err=200012)
svn: '/usr/bin/diff' returned 2

With diff-cmd unset, I get this a diff showing the binary contents of
the change.

I couldn't think of anything easy to do for this. I guess it would be
nice if GNU diff returned more than 2 for its various error
conditions, or if it returned 1 for binary files that differ as well.
Unfortunately, that's not happening. The next thing I thought of
would be to add filetype magic, but that's no small change either.

Then I decided I would turn off the diff-cmd option or use the
svn:mime-type property as intended =)

So it seems like a bug, but I wouldn't call it a high priority issue,
that's for sure!

Let me know if you think I should report it or not, and then maybe
I'll have some time to work on fixing it soon.

Thanks!
Wade

On 8/29/07, Ben Collins-Sussman <sussman@red-bean.com> wrote:
> On 8/28/07, Wade Carpenter <wade.carpenter@gmail.com> wrote:
> > This seems to be related to 1019:
> > http://subversion.tigris.org/issues/show_bug.cgi?id=1019
> >
> > I'm running svn client 1.4.5:
> > svn --version
> > svn, version 1.4.2 (r22196)
> > compiled Jan 18 2007, 11:56:49
>
> Uh, it says 1.4.2, not 1.4.5. :-)
>
> >
> > If I use svn internal diff, this problem is not present.
> >
> > For external diff, I set diff-cmd=/usr/bin/diff in my .subversion/config file.
> > /usr/bin/diff --version
> > diff (GNU diffutils) 2.8.1
> >
> > Example output:
> > svn diff -r11827 subidr/
> > Index: subidr/file.bin
> > ===================================================================
> > Binary files subidr/file.bin (revision 11827) and
> > subidr/file.bin (working copy) differ
> > ../svn_1.4.5/subversion/libsvn_subr/io.c:2230: (apr_err=200012)
> > svn: '/usr/bin/diff' returned 2
>
> Using the latest trunk code, and setting my diff-cmd runtime config
> variable to '/usr/bin/diff' (which is also gnu diff 2.8.1), I can't
> reproduce this problem:
>
> $ svn diff win32.png
> Index: win32.png
> ===================================================================
> Cannot display: file marked as a binary type.
>
>
> ...though maybe something is up with your installation. The error
> message is printing an error from your svn_1.4.5 libsvn_subr library,
> while your 'svn --version' claims to be 1.4.2. Perhaps you've got
> some odd linkage going on, a mixture of library versions?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 30 02:25:16 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.