[PATCH 1 of 2 STABLE] tests-subrepo-git: make the "pwned" message output in a stable order

Kevin Bullock kbullock+mercurial at ringworld.org
Tue May 31 12:28:35 EDT 2016


> On May 27, 2016, at 17:32, danek.duvall at oracle.com wrote:
> 
> # HG changeset patch
> # User Danek Duvall <danek.duvall at oracle.com>
> # Date 1464387038 25200
> #      Fri May 27 15:10:38 2016 -0700
> # Branch stable
> # Node ID c2c56e205a51017b4a2a205efab75882b9f86099
> # Parent  89bba2beb03ea62e7fc8bcf3272e3cda1065ad89
> tests-subrepo-git: make the "pwned" message output in a stable order
> 
> The "pwned" message from this test gets gets sent to stderr, and so may get
> emitted in different places from run to run in the rest of mercurial's
> output.  This patch forces the message to go to a specific file instead,
> whose existence and contents we can examine at a stable point in the test's
> execution.
> 
> diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t
> --- a/tests/test-subrepo-git.t
> +++ b/tests/test-subrepo-git.t
> @@ -1135,7 +1135,7 @@ make sure we show changed files, rather 
> test for Git CVE-2016-3068
>   $ hg init malicious-subrepository
>   $ cd malicious-subrepository
> -  $ echo "s = [git]ext::sh -c echo% pwned% >&2" > .hgsub
> +  $ echo "s = [git]ext::sh -c echo% pwned% >pwned.txt" > .hgsub
>   $ git init s
>   Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/
>   $ cd s
> @@ -1145,23 +1145,27 @@ test for Git CVE-2016-3068
>   $ hg add .hgsub
>   $ hg commit -m "add subrepo"
>   $ cd ..
> +  $ rm -f pwned.txt
>   $ env -u GIT_ALLOW_PROTOCOL hg clone malicious-subrepository malicious-subrepository-protected
>   Cloning into '$TESTTMP/tc/malicious-subrepository-protected/s'... (glob)
>   fatal: transport 'ext' not allowed
>   updating to branch default
> -  cloning subrepo s from ext::sh -c echo% pwned% >&2
> +  cloning subrepo s from ext::sh -c echo% pwned% >pwned.txt
>   abort: git clone error 128 in s (in subrepo s)
>   [255]
> +  $ test -f pwned.txt && cat pwned.txt || true

Is this actually needed? Are there shells that wait to see if there's any output instead of opening the target file for writing right away?

LGTM otherwise.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list