changeset 29295:9b4f0ad02f51 stable

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.
author Danek Duvall <danek.duvall@oracle.com>
date Thu, 02 Jun 2016 16:18:44 -0700
parents 077d0535f51f
children 66dbdd3cc2b9
files tests/test-subrepo-git.t
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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