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

Re: random sort of svn status and svn diff

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Wed, 21 Mar 2012 09:29:12 +0000

Daniel Shahaf <d.s_at_daniel.shahaf.name> writes:

> Sérgio Basto wrote on Wed, Mar 21, 2012 at 07:25:05 +0000:
>> Hi, Dev list , I want to fix random sort of svn status and svn diff, on
>> recent code of svn, it just put a sort somewhere, could someone point me
>> the directory in the source code, where is the code of svn frontend
>> commands like diff and status ?
>
> The frontend code lives in the directory subversion/svn/.
>
> As I said elsethread, you want to patch the library code too, not just
> the frontend code.
>
> Looking forward to hear what approach you're planning to take,

One option would be to replace all the calls to apr_hash_make with a new
function svn_hash_make that calls apr_hash_make_custom with the our own
copy of APR's default hash function. This would bypass APR's random
seed and the hash order would be stable.

In passing I note that the way APR "randomises" the hash is not all that
random. It just adds a fixed prefix to the keys passed to the default
hash function. I thought the point of the APR change was to make it
harder for the user to predict hash collisions and I do wonder whether
this has been achieved. If two strings S1 and S2 collide then does
adding a constant prefix stop the collision?

svnadmin create repo
svn mkdir -mm file://`pwd`/repo/A{0,1,2,3,4,5,6,7,8,9}
svn co file://`pwd`/repo wc
svn ps p v wc/*

Now status shows an unstable order:

svn st wc
 M wc/A5
 M wc/A6
 M wc/A7
 M wc/A8
 M wc/A9
 M wc/A0
 M wc/A1
 M wc/A2
 M wc/A3
 M wc/A4

svn st wc
 M wc/A7
 M wc/A8
 M wc/A9
 M wc/A0
 M wc/A1
 M wc/A2
 M wc/A3
 M wc/A4
 M wc/A5
 M wc/A6

but the "cycle" is always the same N->9,0->N-1.

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com
Received on 2012-03-21 10:29:51 CET

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