Skip to content

Fixes required to build Git for Windows with MSys2 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Feb 22, 2015

Conversation

dscho
Copy link
Member

@dscho dscho commented Feb 22, 2015

This Pull Request, in conjunction with git-for-windows/msys2-runtime#1, makes Git for Windows compile with MSys2 and to pass the test suite.

dscho added 19 commits February 22, 2015 18:50
MSys2's strace facility is very useful for debugging... With this patch,
the bash will be executed through strace if the environment variable
GIT_STRACE_COMMANDS is set, which comes in real handy when investigating
issues in the test suite.

Signed-off-by: Johannes Schindelin <[email protected]>
MSys2' Git build script has some changes we should put into Git for
Windows' source code proper.

Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
MSys2 already has that structure.

Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
The unsetenv code has no idea to update our environ_size, therefore
causing segmentation faults when environment variables are removed
without compat/mingw.c's knowing (MinGW's optimized lookup would try
to strcmp() against NULL in such a case).

Signed-off-by: Johannes Schindelin <[email protected]>
With MSys2, the "TZ" environment variable gets filtered out when calling
non-MSys2 executables. The reason is that Windows' time zone handling is
substantially different from the POSIX one.

However, we just taught Git for Windows' fork of the MSys2 runtime to
pass on the timezone in a different environment variable, MSYS2_TZ for
the sole purpose of Git being able to reinterpret it correctly.

Signed-off-by: Johannes Schindelin <[email protected]>
MSys2 actually allows to create files or directories whose names contain
tabs, newlines or colors, even if plain Win32 API cannot access them.
As we are using an MSys2 bash to run the tests, such files or
directories are created successfully, but Git has no chance to work with
them because it is a regular Windows program, hence limited by the Win32
API.

Signed-off-by: Johannes Schindelin <[email protected]>
With MSys2, there is actually an implementation of mkfifo available. The
only problem is that it is only emulating named pipes through the MSys2
runtime; The Win32 API has no idea about named pipes, hence the Git
executable cannot access those pipes either.

The symptom is that Git fails with a '<name>: No such file or directory'
because MSys2 emulates named pipes through special-crafted '.lnk' files.

The solution is to tell the test suite explicitly that we cannot use
named pipes when we want to test a MinGW Git.

Signed-off-by: Johannes Schindelin <[email protected]>
MSys2's `tr` does not introduce any CRLFs...

This reverts commit 01a6f1b.

Signed-off-by: Johannes Schindelin <[email protected]>
This test is susceptible to MSys2's posix-to-windows path mangling; Let's
just use POSIX paths throughout and let the tests pass.

Signed-off-by: Johannes Schindelin <[email protected]>
There is a really useful debugging technique developed by Sverre
Rabbelier that inserts "bash &&" somewhere in the test scripts, letting
the developer interact at given points with the current state.

Another debugging technique, used a lot by this here coder, is to run
certain executables via gdb by guarding a "gdb -args" call in
bin-wrappers/git.

Both techniques were disabled by 781f76b(test-lib: redirect stdin of
tests).

Let's reinstate the ability to run an interactive shell by making the
redirection optional: setting the TEST_NO_REDIRECT environment variable
will skip the redirection.

Signed-off-by: Johannes Schindelin <[email protected]>
When shell scripts access a $TMP variable containing backslashes, they
will be mistaken for escape characters. Let's not let that happen by
converting them to forward slashes.

This fixes t7800 with MSys2.

Signed-off-by: Johannes Schindelin <[email protected]>
This fixes t7800 with MSys2.

Signed-off-by: Johannes Schindelin <[email protected]>
This test assumed that there are no two equivalent directory separators.
However, on Windows, the back slash and the forward slash *are*
equivalent. Let's paper over this issue by converting the backward
slashes to forward ones in the test that fails with MSys2 otherwise.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho merged this pull request into git-for-windows:master Feb 22, 2015
@dscho dscho deleted the msys2 branch February 22, 2015 18:55
dscho added a commit that referenced this pull request Feb 22, 2015
Fixes required to build Git for Windows with MSys2
@dscho dscho changed the title DO NOT MERGE YET! Fixes required to build Git for Windows with MSys2 Fixes required to build Git for Windows with MSys2 Feb 22, 2015
@sschuberth
Copy link

FYI, it seems this merge started to break 7 more tests on our CI for the MSYS1-based Git SDK, see https://dscho.cloudapp.net/job/sdk-test-git/111/. Probably not a big issue with us going for MSYS2 now, but it still bothers me a bit and I wonder whether we could have made it so that tests work for both MSYS1 and MSYS2.

@dscho
Copy link
Member Author

dscho commented Feb 27, 2015

Booh! I will have a look next week.

@dscho
Copy link
Member Author

dscho commented Feb 28, 2015

Quick hunch: I think that (partially) reverting 3153820 might fix it. Ideally, we would guard the tr post processing in something like

case "$(uname -r)" in
2.*)
    # MSys2's tr works well
    ;;
*)
    [...]
    ;;
esac

@dscho
Copy link
Member Author

dscho commented Feb 28, 2015

I have to admit that I have no clue so far about t7400. The test was virtually unchanged since 1.9.5.

And t9020 should stop to fail once merging update-to-2.3.0 is merged given that all tests are skipped with MinGW then...

@dscho
Copy link
Member Author

dscho commented Mar 1, 2015

Update: compiling the code as of #27 in my msysGit setup (with minor touch-ups – essentially separating MSys1 from MSys2 settings – that I will squash into the appropriate commits) lets t5000, t7400 and t9020 pass just fine.

dscho added a commit that referenced this pull request Mar 6, 2015
Fixes required to build Git for Windows with MSys2
dscho added a commit that referenced this pull request Mar 6, 2015
Fixes required to build Git for Windows with MSys2
@sschuberth sschuberth mentioned this pull request Mar 7, 2015
@sschuberth
Copy link

I couldn't resist and did have a deeper look into why t7400 fails with MSYS1. To start off with, the failure is totally unrelated to this PR as t7400 already started to fail in test build 106 before this PR was even merged.

Anyway, again for the record: When using the same Git-SDK artifact and Git artifact as the test build I can reproduce the failure locally. However, when using the previous Git artifact with the same Git-SDK the failure disappears. Even just swapping the git.exe file makes the failure go away or reappear. So the failure is introduced by Git, not by the SDK. But both Git artifacts were built from the same SHA1 8ffc0c2! Further looking at what triggered the build that created the failing Git artifact we see that it was "A change within the response URL invocation". Unfortunately the log for this is gone, but this means there was a package update in upstream MSYS.

So my hunch is that a part of the toolchain was changed in a way that it broke something related to UTF-8 encoding when building Git. At this point I'll stop as I'm confident this is not easy to fix.

dscho added a commit that referenced this pull request Mar 21, 2015
Fixes required to build Git for Windows with MSys2
dscho pushed a commit that referenced this pull request Mar 24, 2015
Fixes required to build Git for Windows with MSys2
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