[PATCH 0 of 1] revlog: fix partial read error introduced in 57a41c08feab (issue1672)

Henrik Stuart hg at hstuart.dk
Sat May 23 04:50:01 CDT 2009


The introduction of pre-reading a partial amount of the revlog has
introduced an issue of only the pre-read size ever being read if
util.openhardlinks() evalutes to False, or if the revlog is inline and
is larger than the pre-read size. All other cases will be handled
adequately by the lazy revlog parser.

Any revlog over _prereadsize will, on Windows, exhibit a verify error
as only the start of the revlog is read. Any inline revlog larger than
_prereadsize will exhibit the error on any platform. The following
Python program triggers the error - a faster version can probably be
made. It expects that the following commands have been run in advance:

hg init .
echo a > foo
hg add foo
hg ci -m init

Python program:

from __future__ import with_statement
from mercurial.commands import commit, verify
from mercurial.ui import ui
from mercurial.hg import repository

u = ui()
r = repository(u, '.')

for i in xrange(10000000):
    with open('foo', 'w') as f:
        f.write(str(i))
    commit(u, r, message = str(i))

this will, at some point, cause the following error:
mercurial.error.RevlogError: index data/foo.i is corrupted

-- 
Kind regards,
  Henrik Stuart


More information about the Mercurial-devel mailing list