[PATCH STABLE] tests-subrepo-git: make the "pwned" message output in a stable order
danek.duvall at oracle.com
danek.duvall at oracle.com
Fri May 27 00:47:53 UTC 2016
# HG changeset patch
# User Danek Duvall <danek.duvall at oracle.com>
# Date 1464309643 25200
# Thu May 26 17:40:43 2016 -0700
# Branch stable
# Node ID 821cafd65aac2b2199764acba0b1ede8d6e62b6e
# 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 gets
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 contents we can examine in 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
@@ -1149,19 +1149,20 @@ test for Git CVE-2016-3068
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]
whitelisting of ext should be respected (that's the git submodule behaviour)
$ env GIT_ALLOW_PROTOCOL=ext hg clone malicious-subrepository malicious-subrepository-clone-allowed
Cloning into '$TESTTMP/tc/malicious-subrepository-clone-allowed/s'... (glob)
- pwned
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
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]
+ $ cat pwned.txt
+ pwned
More information about the Mercurial-devel
mailing list