[PATCH 2 of 2 stable] streamclone: fix error when store files grow while stream cloning

Augie Fackler raf at durin42.com
Mon Mar 14 13:42:27 EDT 2016


On Sat, Mar 12, 2016 at 05:57:43PM -0800, Gregory Szorc wrote:
> Yikes. Good catch.
>
> Series LGTM.

Queued these, thanks for reviewing!

>
> I dare say this one is severe enough to warrant an out-of-cycle release
> because it can result in serving corrupt clones. I'm actually somewhat
> surprised I haven't heard reports of this biting us at Mozilla.
>
> On Sat, Mar 12, 2016 at 5:29 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
>
> > # HG changeset patch
> > # User Mads Kiilerich <madski at unity3d.com>
> > # Date 1457832551 -3600
> > #      Sun Mar 13 02:29:11 2016 +0100
> > # Branch stable
> > # Node ID aa440c3d7c5d2baafeb632ee35db4d917ed9cf83
> > # Parent  95163ababeb86d6ca889e5e57a0c4eadb77b53d8
> > streamclone: fix error when store files grow while stream cloning
> >
> > Effectively a backout of 9fea6b38a8da, but updated to using 'with'.
> >
> > diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
> > --- a/mercurial/streamclone.py
> > +++ b/mercurial/streamclone.py
> > @@ -206,7 +206,8 @@ def generatev1(repo):
> >                  # partially encode name over the wire for backwards compat
> >                  yield '%s\0%d\n' % (store.encodedir(name), size)
> >                  if size <= 65536:
> > -                    yield svfs.read(name)
> > +                    with svfs(name, 'rb') as fp:
> > +                        yield fp.read(size)
> >                  else:
> >                      for chunk in util.filechunkiter(svfs(name),
> > limit=size):
> >                          yield chunk
> > diff --git a/tests/test-clone-uncompressed.t
> > b/tests/test-clone-uncompressed.t
> > --- a/tests/test-clone-uncompressed.t
> > +++ b/tests/test-clone-uncompressed.t
> > @@ -88,10 +88,5 @@ actually serving file content
> >    $ echo >> repo/f2
> >    $ hg -R repo ci -m "1"
> >    $ wait
> > -  abort: unexpected response from remote server:
> > -  '*\n' (glob)
> >    $ hg -R clone id
> > -  abort: repository clone not found!
> > -  [255]
> > -
> > -the current clone error is a regression from 9fea6b38a8da.
> > +  000000000000
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> >

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list