git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] t0061: fix test for argv[0] with spaces (MINGW only)
@ 2019-10-01 11:41 Alexandr Miloslavskiy via GitGitGadget
  2019-10-01 11:41 ` [PATCH 1/1] " Alexandr Miloslavskiy via GitGitGadget
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandr Miloslavskiy via GitGitGadget @ 2019-10-01 11:41 UTC (permalink / raw)
  To: git; +Cc: Alexandr Miloslavskiy, Junio C Hamano

The test was originally designed for the case where user reported that
setting GIT_SSH to a .bat file with spaces in path fails on Windows: 
https://github.com/git-for-windows/git/issues/692

The test has two different problems:

 1. It succeeds with AND without fix eb7c7863 that addressed user's problem.
    This happens because the core problem was misunderstood, leading to
    conclusion that git is unable to start any programs with spaces in path
    on Win7. But in fact a) Bug only affected cmd.exe scripts, such as .bat
    scripts b) Bug only happened when cmd.exe received at least two quoted
    args c) Bug happened on any Windows (verified on Win10). Therefore,
    correct test must involve .bat script and two quoted args.
 2. In Visual Studio build, it fails to run, because 'test-fake-ssh.exe' is
    copied away from its dependencies 'libiconv.dll' and 'zlib1.dll'.

Fix both problems by using .bat script instead of 'test-fake-ssh.exe'. NOTE:
With this change, the test now correctly fails without eb7c7863.

Signed-off-by: Alexandr Miloslavskiy alexandr.miloslavskiy@syntevo.com
[alexandr.miloslavskiy@syntevo.com]

Alexandr Miloslavskiy (1):
  t0061: fix test for argv[0] with spaces (MINGW only)

 t/t0061-run-command.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)


base-commit: 4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-356%2FSyntevoAlex%2F%230191_t0061_fixes-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-356/SyntevoAlex/#0191_t0061_fixes-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/356
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] t0061: fix test for argv[0] with spaces (MINGW only)
  2019-10-01 11:41 [PATCH 0/1] t0061: fix test for argv[0] with spaces (MINGW only) Alexandr Miloslavskiy via GitGitGadget
@ 2019-10-01 11:41 ` Alexandr Miloslavskiy via GitGitGadget
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandr Miloslavskiy via GitGitGadget @ 2019-10-01 11:41 UTC (permalink / raw)
  To: git; +Cc: Alexandr Miloslavskiy, Junio C Hamano, Alexandr Miloslavskiy

From: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>

The test was originally designed for the case where user reported
that setting GIT_SSH to a .bat file with spaces in path fails on
Windows: https://github.com/git-for-windows/git/issues/692

The test has two different problems:

1. It succeeds with AND without fix eb7c7863 that addressed user's
   problem. This happens because the core problem was misunderstood,
   leading to conclusion that git is unable to start any programs with
   spaces in path on Win7. But in fact
     a) Bug only affected cmd.exe scripts, such as .bat scripts
     b) Bug only happened when cmd.exe received at least two quoted args
     c) Bug happened on any Windows (verified on Win10).
   Therefore, correct test must involve .bat script and two quoted args.
2. In Visual Studio build, it fails to run, because 'test-fake-ssh.exe'
   is copied away from its dependencies 'libiconv.dll' and 'zlib1.dll'.

Fix both problems by using .bat script instead of 'test-fake-ssh.exe'.
NOTE: With this change, the test now correctly fails without eb7c7863.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
---
 t/t0061-run-command.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 015fac8b5d..42c2b6dafa 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -210,10 +210,23 @@ test_expect_success MINGW 'verify curlies are quoted properly' '
 	test_cmp expect actual
 '
 
-test_expect_success MINGW 'can spawn with argv[0] containing spaces' '
-	cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" ./ &&
-	test_must_fail "$PWD/test-fake-ssh$X" 2>err &&
-	grep TRASH_DIRECTORY err
+test_expect_success MINGW 'can spawn .bat with argv[0] containing spaces' '
+	bat="$TRASH_DIRECTORY/bat with spaces in name.bat" &&
+	
+	# Every .bat invocation will log its arguments to file "out"
+	rm -f out &&
+	echo "echo %* >>out" >"$bat" &&
+	
+	# Ask git to invoke .bat; clone will fail due to fake SSH helper
+	test_must_fail env GIT_SSH="$bat" git clone myhost:src ssh-clone &&
+	
+	# Spawning .bat can fail if there are two quoted cmd.exe arguments.
+	# .bat itself is first (due to spaces in name), so just one more is
+	# needed to verify. GIT_SSH will invoke .bat multiple times:
+	# 1) -G myhost
+	# 2) myhost "git-upload-pack src"
+	# First invocation will always succeed. Test the second one.
+	grep "git-upload-pack" out
 '
 
 test_done
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-01 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 11:41 [PATCH 0/1] t0061: fix test for argv[0] with spaces (MINGW only) Alexandr Miloslavskiy via GitGitGadget
2019-10-01 11:41 ` [PATCH 1/1] " Alexandr Miloslavskiy via GitGitGadget

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).