Patchwork [1,of,2,STABLE,V2] tests: add test demonstrating buggy path handling

login
register
mail settings
Submitter Gregory Szorc
Date April 7, 2017, 6:54 p.m.
Message ID <f8ba1fb4458b60b1d129.1491591294@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/20011/
State Accepted
Headers show

Comments

Gregory Szorc - April 7, 2017, 6:54 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1491590783 25200
#      Fri Apr 07 11:46:23 2017 -0700
# Branch stable
# Node ID f8ba1fb4458b60b1d129f97d1f47a542aa0daf98
# Parent  68f263f52d2e3e2798b4f1e55cb665c6b043f93b
tests: add test demonstrating buggy path handling

`hg debugupgraderepo` is currently buggy with regards to path
handling when copying files in .hg/store/. Specifically, it applies
the store filename encoding to paths instead of operating on raw
files.

This commit adds a test demonstrating the buggy behavior.
Yuya Nishihara - April 8, 2017, 8:39 a.m.
On Fri, 07 Apr 2017 11:54:54 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1491590783 25200
> #      Fri Apr 07 11:46:23 2017 -0700
> # Branch stable
> # Node ID f8ba1fb4458b60b1d129f97d1f47a542aa0daf98
> # Parent  68f263f52d2e3e2798b4f1e55cb665c6b043f93b
> tests: add test demonstrating buggy path handling
> 
> `hg debugupgraderepo` is currently buggy with regards to path
> handling when copying files in .hg/store/. Specifically, it applies
> the store filename encoding to paths instead of operating on raw
> files.
> 
> This commit adds a test demonstrating the buggy behavior.
> 
> diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
> --- a/tests/test-upgrade-repo.t
> +++ b/tests/test-upgrade-repo.t
> @@ -310,3 +310,38 @@ old store should be backed up
>    undo.phaseroots
>  
>    $ cd ..
> +
> +store files with special filenames aren't encoded during copy
> +
> +  $ hg init store-filenames
> +  $ cd store-filenames
> +  $ touch foo
> +  $ hg -q commit -A -m initial
> +  $ touch .hg/store/.XX_special_filename
> +
> +  $ hg debugupgraderepo --run
> +  upgrade will perform the following actions:
> +  
> +  requirements
> +     preserved: dotencode, fncache, generaldelta, revlogv1, store
> +  
> +  beginning upgrade...
> +  repository locked and read-only
> +  creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
> +  (it is safe to interrupt this process any time before data migration completes)
> +  migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
> +  migrating 109 bytes in store; 107 bytes tracked data
> +  migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data)
> +  finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
> +  migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data)
> +  finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
> +  migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data)
> +  finished migrating 1 changelog revisions; change in size: 0 bytes
> +  finished migrating 3 total revisions; total change in store size: 0 bytes
> +  copying phaseroots
> +  copying .XX_special_filename

The order is unstable. I could add "2>&1 | egrep 'abort|XX'", but do you have
any better idea?
Gregory Szorc - April 8, 2017, 6:37 p.m.
On Sat, Apr 8, 2017 at 1:39 AM, Yuya Nishihara <yuya@tcha.org> wrote:

> On Fri, 07 Apr 2017 11:54:54 -0700, Gregory Szorc wrote:
> > # HG changeset patch
> > # User Gregory Szorc <gregory.szorc@gmail.com>
> > # Date 1491590783 25200
> > #      Fri Apr 07 11:46:23 2017 -0700
> > # Branch stable
> > # Node ID f8ba1fb4458b60b1d129f97d1f47a542aa0daf98
> > # Parent  68f263f52d2e3e2798b4f1e55cb665c6b043f93b
> > tests: add test demonstrating buggy path handling
> >
> > `hg debugupgraderepo` is currently buggy with regards to path
> > handling when copying files in .hg/store/. Specifically, it applies
> > the store filename encoding to paths instead of operating on raw
> > files.
> >
> > This commit adds a test demonstrating the buggy behavior.
> >
> > diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
> > --- a/tests/test-upgrade-repo.t
> > +++ b/tests/test-upgrade-repo.t
> > @@ -310,3 +310,38 @@ old store should be backed up
> >    undo.phaseroots
> >
> >    $ cd ..
> > +
> > +store files with special filenames aren't encoded during copy
> > +
> > +  $ hg init store-filenames
> > +  $ cd store-filenames
> > +  $ touch foo
> > +  $ hg -q commit -A -m initial
> > +  $ touch .hg/store/.XX_special_filename
> > +
> > +  $ hg debugupgraderepo --run
> > +  upgrade will perform the following actions:
> > +
> > +  requirements
> > +     preserved: dotencode, fncache, generaldelta, revlogv1, store
> > +
> > +  beginning upgrade...
> > +  repository locked and read-only
> > +  creating temporary repository to stage migrated data:
> $TESTTMP/store-filenames/.hg/upgrade.* (glob)
> > +  (it is safe to interrupt this process any time before data migration
> completes)
> > +  migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in
> changelog)
> > +  migrating 109 bytes in store; 107 bytes tracked data
> > +  migrating 1 filelogs containing 1 revisions (0 bytes in store; 0
> bytes tracked data)
> > +  finished migrating 1 filelog revisions across 1 filelogs; change in
> size: 0 bytes
> > +  migrating 1 manifests containing 1 revisions (46 bytes in store; 45
> bytes tracked data)
> > +  finished migrating 1 manifest revisions across 1 manifests; change in
> size: 0 bytes
> > +  migrating changelog containing 1 revisions (63 bytes in store; 62
> bytes tracked data)
> > +  finished migrating 1 changelog revisions; change in size: 0 bytes
> > +  finished migrating 3 total revisions; total change in store size: 0
> bytes
> > +  copying phaseroots
> > +  copying .XX_special_filename
>
> The order is unstable. I could add "2>&1 | egrep 'abort|XX'", but do you
> have
> any better idea?
>

Doh. V3 sent with a new patch to add a sorted(). I also added a missing
(glob) for the "0.0s" bit.

Patch

diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t
--- a/tests/test-upgrade-repo.t
+++ b/tests/test-upgrade-repo.t
@@ -310,3 +310,38 @@  old store should be backed up
   undo.phaseroots
 
   $ cd ..
+
+store files with special filenames aren't encoded during copy
+
+  $ hg init store-filenames
+  $ cd store-filenames
+  $ touch foo
+  $ hg -q commit -A -m initial
+  $ touch .hg/store/.XX_special_filename
+
+  $ hg debugupgraderepo --run
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: dotencode, fncache, generaldelta, revlogv1, store
+  
+  beginning upgrade...
+  repository locked and read-only
+  creating temporary repository to stage migrated data: $TESTTMP/store-filenames/.hg/upgrade.* (glob)
+  (it is safe to interrupt this process any time before data migration completes)
+  migrating 3 total revisions (1 in filelogs, 1 in manifests, 1 in changelog)
+  migrating 109 bytes in store; 107 bytes tracked data
+  migrating 1 filelogs containing 1 revisions (0 bytes in store; 0 bytes tracked data)
+  finished migrating 1 filelog revisions across 1 filelogs; change in size: 0 bytes
+  migrating 1 manifests containing 1 revisions (46 bytes in store; 45 bytes tracked data)
+  finished migrating 1 manifest revisions across 1 manifests; change in size: 0 bytes
+  migrating changelog containing 1 revisions (63 bytes in store; 62 bytes tracked data)
+  finished migrating 1 changelog revisions; change in size: 0 bytes
+  finished migrating 3 total revisions; total change in store size: 0 bytes
+  copying phaseroots
+  copying .XX_special_filename
+  removing temporary repository $TESTTMP/store-filenames/.hg/upgrade.* (glob)
+  abort: No such file or directory: $TESTTMP/store-filenames/.hg/store/~2e_x_x__special__filename
+  [255]
+
+  $ cd ..