Skip to content

t0061: fix test for argv[0] with spaces (MINGW only) - #651

Closed
SyntevoAlex wants to merge 1 commit into
git:masterfrom
SyntevoAlex:#0191_t0061_fixes
Closed

t0061: fix test for argv[0] with spaces (MINGW only)#651
SyntevoAlex wants to merge 1 commit into
git:masterfrom
SyntevoAlex:#0191_t0061_fixes

Conversation

@SyntevoAlex

Copy link
Copy Markdown
Contributor

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: git-for-windows#692

The test has two different problems:

  1. It fails to run on clean MINGW, because 'test-fake-ssh.exe' is
    copied away from its dependencies 'libiconv.dll' and 'zlib1.dll'.
    Even when test succeeds, this is still not quite right, because it
    unexpectedly uses MINGW dependencies instead of the built ones.
  2. With (1) out of the way, the test succeeds with AND without fix
    eb7c786 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) it only affects cmd.exe scripts, such as .bat scripts
    b) it only happens when cmd.exe receives at least two quoted args
    c) it happens on any Windows (verified on Win10).
    Therefore, correct test must involve .bat script and two quoted args.

Fix both problems by using .bat script.
NOTE: With this change, the test now correctly fails without eb7c786.

Signed-off-by: Alexandr Miloslavskiy [email protected]

@dscho

dscho commented Sep 25, 2019

Copy link
Copy Markdown
Member

Looks good!

Please note that running the test within a make or prove run will still pick up the correct .dll files. Even running the test script on its own will work, just not when building with MSVC.

Maybe you want to adjust the commit message?

Oh, and I restarted the failed Travis job. It was a temporary problem with apt that prevented Ubuntu packages from being installed in the Linux32 job.

To submit the patch to the Git mailing list for review, you could use GitGitGadget as before, or submitGit, or send it manually.

@SyntevoAlex

Copy link
Copy Markdown
Contributor Author

For me the test fails at least when running it with prove or with ./t0061-run-command.sh.

I have now tried to put which libiconv.dll into the test body and received this output when running ./t0061-run-command.sh from Git SDK:
which: no libiconv.dll in (<snip>/git-for-windows/t/../bin-wrappers:/c/Users/alex/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/alex/bin:<snip>)

So this is expected that executable fails to run, because indeed its dependencies can't be found on PATH and also can't be found next to .exe.

Am I misunderstanding something?

@dscho

dscho commented Sep 25, 2019

Copy link
Copy Markdown
Member

For me the test fails at least when running it with prove or with ./t0061-run-command.sh.

Oh, I thought via make... (DEFAULT_TEST_TARGET = prove). That will add t/helper/ to the PATH, which is why it works in the Azure Pipeline (where make is used).

@dscho

dscho commented Sep 25, 2019

Copy link
Copy Markdown
Member

Also, if you build in Git for Windows' SDK using GCC, and run the test suite also in that SDK, there won't be any .dll files in t/helper/.

@SyntevoAlex

Copy link
Copy Markdown
Contributor Author

So it seems that commit message was correct, then? Because the test fails without additional external settings? If not, can you please suggest the desired wording?

@dscho

dscho commented Sep 25, 2019

Copy link
Copy Markdown
Member

So it seems that commit message was correct, then?

In a manner of speaking.

What it left out was that the common way to build Git is not using MSVC, but GCC. So in most cases, even when Git is built on Windows, there is no problem with .dll files.

That's the part I am missing from the commit message.

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: git-for-windows#692

The test has two different problems:

1. It succeeds with AND without fix eb7c786 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 eb7c786.

Signed-off-by: Alexandr Miloslavskiy <[email protected]>
@SyntevoAlex

Copy link
Copy Markdown
Contributor Author

Oh! Only now I understood that I pushed the wrong button and created PR in a wrong repo.
I have now re-created as gitgitgadget#356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants