# HG changeset patch # User Danek Duvall # Date 1464909524 25200 # Node ID 9b4f0ad02f5182498f196fe9c603b4e0e39664ad # Parent 077d0535f51f9e40d2e3ffc74c5d2c3badc4407c tests-subrepo-git: use "f" to dump pwned.txt, for portability Rather than sometimes using a complicated shell construct to dump pwned.txt (if it wasn't expected to exist, but might, if something were broken) or just cat (if it was expected to exist), just use the "f" utility, which will be consistent in its behavior across different platforms. Also make sure that *something* gets put into pwned.txt, even if we ended up typoing the message variable. diff -r 077d0535f51f -r 9b4f0ad02f51 tests/test-subrepo-git.t --- a/tests/test-subrepo-git.t Wed Jun 01 21:40:52 2016 +0200 +++ b/tests/test-subrepo-git.t Thu Jun 02 16:18:44 2016 -0700 @@ -1135,7 +1135,7 @@ test for Git CVE-2016-3068 $ hg init malicious-subrepository $ cd malicious-subrepository - $ echo "s = [git]ext::sh -c echo% \$PWNED_MSG% >pwned.txt" > .hgsub + $ echo "s = [git]ext::sh -c echo% pwned:% \$PWNED_MSG% >pwned.txt" > .hgsub $ git init s Initialized empty Git repository in $TESTTMP/tc/malicious-subrepository/s/.git/ $ cd s @@ -1152,10 +1152,11 @@ 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_MSG% >pwned.txt + cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt abort: git clone error 128 in s (in subrepo s) [255] - $ test -f pwned.txt && cat pwned.txt || true + $ f -Dq pwned.txt + pwned.txt: file not found whitelisting of ext should be respected (that's the git submodule behaviour) $ rm -f pwned.txt @@ -1167,8 +1168,8 @@ 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_MSG% >pwned.txt + cloning subrepo s from ext::sh -c echo% pwned:% $PWNED_MSG% >pwned.txt abort: git clone error 128 in s (in subrepo s) [255] - $ cat pwned.txt - you asked for it + $ f -Dq pwned.txt + pwned: you asked for it