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

Re: How to recover from a "checksum mismatch"

From: Ryan Schmidt <subversion-2010a_at_ryandesign.com>
Date: Sun, 21 Feb 2010 08:37:00 -0600

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


> 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.
Received on 2010-02-21 15:37:42 CET

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

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