You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Peter Cech <ce...@kooaba.com> on 2009/10/12 16:21:29 UTC

svn diff --diff-cmd=diff fails if there is a modified binary file

Hello,

the diff command (part of coreutils IIRC) returns status 2 if there is  
a difference in binary files (status 1 means a difference in text  
files). Subversion apparently only accepts return status 0 and 1.  
Attempt to retrieve a diff from repository

   svn diff --diff-cmd=diff -c 3916 svn://localhost/

yields an error:

   svn: 'diff' returned 2

The attached patch fixes the issue for me. Does it look like right/ 
complete way of fixing this issue?

Thanks!

--
Peter Cech
Software Engineer

kooaba | Technoparkstrasse 1 | 8005 Zurich | Switzerland
+41 44 633 76 65 | cech@kooaba.com | http://www.kooaba.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2406718

Re: svn diff --diff-cmd=diff fails if there is a modified binary file

Posted by Peter Cech <ce...@kooaba.com>.
On Oct 12, 2009, at 6:44 PM, Stefan Sperling wrote:

> On Mon, Oct 12, 2009 at 06:21:29PM +0200, Peter Cech wrote:
>> Hello,
>>
>> the diff command (part of coreutils IIRC) returns status 2 if there  
>> is
>> a difference in binary files (status 1 means a difference in text
>> files). Subversion apparently only accepts return status 0 and 1.
>> Attempt to retrieve a diff from repository
>>
>>   svn diff --diff-cmd=diff -c 3916 svn://localhost/
>>
>> yields an error:
>>
>>   svn: 'diff' returned 2
>
> That's not portable. E.g. OpenBSD's diff returns >1 to indicate
> that "an error occured".

Thanks, I did not know that.

> You might want to use a wrapper script around GNU diff which  
> interprets
> the exit code and transforms it to either 0 or 1.

Good idea, much better than patching subversion.

>> The attached patch fixes the issue for me. Does it look like right/
>> complete way of fixing this issue?
>
> Looks like you forgot to attach it.

Happens to me frequently :( Anyway, your suggestion with wrapper  
script makes it irrelevant.

Thanks!

Peter

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2407079

Re: svn diff --diff-cmd=diff fails if there is a modified binary file

Posted by Stefan Sperling <st...@elego.de>.
On Mon, Oct 12, 2009 at 06:21:29PM +0200, Peter Cech wrote:
> Hello,
> 
> the diff command (part of coreutils IIRC) returns status 2 if there is  
> a difference in binary files (status 1 means a difference in text  
> files). Subversion apparently only accepts return status 0 and 1.  
> Attempt to retrieve a diff from repository
> 
>    svn diff --diff-cmd=diff -c 3916 svn://localhost/
> 
> yields an error:
> 
>    svn: 'diff' returned 2

That's not portable. E.g. OpenBSD's diff returns >1 to indicate
that "an error occured".

You might want to use a wrapper script around GNU diff which interprets
the exit code and transforms it to either 0 or 1.

> The attached patch fixes the issue for me. Does it look like right/ 
> complete way of fixing this issue?

Looks like you forgot to attach it.

Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2406731