You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Gregory Berkolaiko <gb...@gmail.com> on 2010/02/20 20:09:43 UTC

How to recover from a "checksum mismatch"

Hello,

Due to some (yet unknown) mistake, my colleague is experiencing a
"checksum mismatch" error message.  Is there a civilized way to
recover from such a mismatch.  The solutions I found posted on the web
are all klutches: the mildest being "check out a fresh copy,
substitute the text-base file causing the conflict" and the worst
being "svn delete then svn add".

It seems to me having an "svn revert --force blah" revert everything
completely, including the text-base files is the optimal solution to
the problem (unless another solution exists that I just couldn't
find).

Best wishes,
Gregory

P.S. Please CC the replies to me, if possible.

Re: How to recover from a "checksum mismatch"

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 21, 2010, at 06:26, Gregory Berkolaiko wrote:

> Let's say
>  .svn/text-base/README.svn-base
> got corrupted.  For this discussion it is irrelevant "how" it got to
> be corrupted.

Well, to the Subversion mindset, that's the only thing that's relevant, since Subversion assumes nobody changes the contents of the .svn directories except Subversion, and that Subversion always modifies the contents of the .svn directories correctly. The latter assumption could of course be false if there is a bug in Subversion, but if so, that should be reported and fixed. Since Subversion has been around for awhile, I hope the number of outstanding bugs in its handling of basic functions like the .svn directories is very small.


> The problem is that now the working copy is in an
> unusable state

Correct...

> and  svn revert should restore it to a working state.

Not necessarily. That's not exactly what "svn revert" means.

> Here are the commands I use (assuming README is underthe version control):
> 
> 1. chmod u+w .svn/text-base/README.svn-base
> 
> Now make some changes:
> 2. pico .svn/text-base/README.svn-base
> 
> Now make some other changes to the proper file:
> 3. pico README
> 
> 4. svn up
> At revision 185.
> 
> 5. svn commit -m "ttt"
> Sending        README
> Transmitting file data .svn: Commit failed (details follow):
> svn: Checksum mismatch for
> '/Users/gregoryberkolaiko/projects/berkment/.svn/text-base/README.svn-base';
> expected: '5a6a937b0f8952d6a9c9da4a396e0aa1', actual:
> 'c92c10f82a4f704133c67def8fde242a'
> 
> Now what?

Now your working copy is broken and should be repaired manually. For example you could check out a fresh working copy and copy that text-base file from the fresh working copy into the same place within the broken working copy.

It might be nice if Subversion offered an automated way to repair the content of .svn directories. However, there's probably not much need to: Subversion currently assumes the .svn directories do not get corrupted, which is not such an unreasonable assumption: a checksum error or other corruption in the .svn directories either indicates the user modified it, which is a user error; or a bug in Subversion, which should be reported and fixed; or a hardware error such as a bad hard drive, which the user should fix.


> Suppose I am to give up on my changes:
> 
> 6. rm README
> 
> 7. svn up
> Restored 'README'
> At revision 185.
> 
> If you inspect README, you notice that it got restored not to the
> repository state, but to the local cached state
> (in essence, "cp .svn/text-base/README.svn-base README")
> 
> svn revert
> does exactly the same: uses the corrupted local cached version.

It is correct that the purpose of the revert command is to copy a file from the text-base to the main working copy area. I don't know the source code, but as a user it surprises me a little that Subversion didn't verify the integrity of the text-base file using its checksum before doing so. I'm not totally surprised that "svn up" shortcuts to getting the file from the text-base when it's available there.


> There should be a way to revert the cached version too!

Perhaps Subversion will pull it from the repository if you delete it from the text-base and then update. If not, deleting the entire directory containing the problem file and then updating again should definitely do so.


Re: How to recover from a "checksum mismatch"

Posted by Gregory Berkolaiko <gb...@gmail.com>.
I am afraid you misunderstood my problem, or maybe I misunderstand you solution.
Let's say
  .svn/text-base/README.svn-base
got corrupted.  For this discussion it is irrelevant "how" it got to
be corrupted.  The problem is that now the working copy is in an
unusable state and  svn revert should restore it to a working state.

Here are the commands I use (assuming README is underthe version control):

1. chmod u+w .svn/text-base/README.svn-base

Now make some changes:
2. pico .svn/text-base/README.svn-base

Now make some other changes to the proper file:
3. pico README

4. svn up
At revision 185.

5. svn commit -m "ttt"
Sending        README
Transmitting file data .svn: Commit failed (details follow):
svn: Checksum mismatch for
'/Users/gregoryberkolaiko/projects/berkment/.svn/text-base/README.svn-base';
expected: '5a6a937b0f8952d6a9c9da4a396e0aa1', actual:
'c92c10f82a4f704133c67def8fde242a'

Now what?

Suppose I am to give up on my changes:

6. rm README

7. svn up
Restored 'README'
At revision 185.

If you inspect README, you notice that it got restored not to the
repository state, but to the local cached state
(in essence, "cp .svn/text-base/README.svn-base README")

svn revert
does exactly the same: uses the corrupted local cached version.

There should be a way to revert the cached version too!

Best wishes,
Gregory

On 20 February 2010 23:21, Chris Withers <ch...@simplistix.co.uk> wrote:
> Gregory Berkolaiko wrote:
>>
>> Due to some (yet unknown) mistake, my colleague is experiencing a
>> "checksum mismatch" error message.  Is there a civilized way to
>> recover from such a mismatch.  The solutions I found posted on the web
>> are all klutches: the mildest being "check out a fresh copy,
>> substitute the text-base file causing the conflict" and the worst
>> being "svn delete then svn add".
>
> I just svn up'd and the problem went away :-S
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>            - http://www.simplistix.co.uk
>

Re: How to recover from a "checksum mismatch"

Posted by Chris Withers <ch...@simplistix.co.uk>.
Gregory Berkolaiko wrote:
> Due to some (yet unknown) mistake, my colleague is experiencing a
> "checksum mismatch" error message.  Is there a civilized way to
> recover from such a mismatch.  The solutions I found posted on the web
> are all klutches: the mildest being "check out a fresh copy,
> substitute the text-base file causing the conflict" and the worst
> being "svn delete then svn add".

I just svn up'd and the problem went away :-S

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk