Argh!!!
Matt Mackall
mpm at selenic.com
Thu Mar 15 18:56:15 UTC 2007
On Wed, Mar 14, 2007 at 01:04:33AM -0600, Phillip Neiswanger wrote:
> prompt> hg status
...
> self.manifest = manifest.manifest(self.sopener, v)
...
> e = struct.unpack(self.indexformat, cur)
> struct.error: unpack str size does not match format
Ok, we've somehow gotten a short string here. This shouldn't happen as
we've got checks in place.
> prompt> hg recover
> rolling back interrupted transaction
> checking changesets
> checking manifests
> manifest index contains 19 extra bytes
Those extra 19 bytes are a problem. A clone --pull at this point would
have fixed things.
> I commit as root and the commit appears to work just fine.
Oops. We've appended data onto a corrupt entry. Now we've got an entry
which is 19 bytes of garbage plus (64-19) bytes of your new entry,
giving us an utterly meaningless entry. This would be mostly harmless
except we use the data length part the entry to skip past the interleaved
data. I suspect we're getting a giant negative length which is
confusing us. Try this patch:
diff -r 3be4785f8994 mercurial/revlog.py
--- a/mercurial/revlog.py Wed Mar 14 19:13:04 2007 -0500
+++ b/mercurial/revlog.py Thu Mar 15 13:57:57 2007 -0500
@@ -425,10 +425,13 @@ class revlog(object):
self.nodemap[e[-1]] = n
n += 1
if inline:
+ if e[1] < 0:
+ break
off += e[1]
if off > l:
# some things don't seek well, just read it
fp.read(off - l)
+ break
if not st:
break
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list