Repository navigation
Look into MSys2 #25
Copy link
Copy link
Closed
Labels
Description
I am looking into using MSys2 for future Git for Windows development, for a couple of reasons:
- MSys2 packages are much more up-to-date than MSys ones
- MSys2 offers a nice, stable package management system, pacman (ported from Arch Linux)
- MSys2 already ships with mintty, a powerful alternative to the
cmd.execommand-line window - MSys2 has 64-bit support
- MSys2 allows us to (re-)build Perl with Subversion bindings easily (at least that is the impression I got)
This ticket mainly serves as a notepad listing quirks and issues I find out while working on getting Git for Windows to build with MSys2.
It is quite easy to get started with MSys2:
- download and install MSys2 as mentioned on https://msys2.github.io/
- run the MINGW shell (not the MSys2 shell) from the Start Menu
- run
pacman -Sy git mingw-w64-x86_64-gccto install Git and GCC (-Smeans "synchronize", i.e. install, and-ydoes not mean "yes" but "refresh the package list before installing the newest versions of the specified packages") - clone https://github.com/git-for-windows/MINGW-packages, say, into
/usr/src/ - in
MINGW-packages/mingw-w64-git/, runmakepkg-mingw -s(the-ssays: install all dependencies, including build time dependencies, viapacman) - Play with the unpacked sources (they are in the
src/build-x86_64/or thesrc/build-i686/subdirectory)
So it looks that it is pretty easy to get started, as well as to rebuild the MSys2 installer (which we might want to do in order to continue offering a net installer to contributors that avoids requiring manual steps).
Having said that, there are a few bumps on the road to heave: The following issues need to be solved before we can start bundling up even so much as a portable application:
- tab completion in the MSys2 shell seems to be flakey (it sometimes does not find anything, and pressing the Tab key repeatedly will not do anything in that case, but often it helps to delete the last character, retype it, and then press the Tab key again). This did not happen with the MinGW shell, funnily enough, so it might not be a huge problem for us; However, it could indicate a more problematic, deeper bug
- MSys2's
opensshrefuses to heed theHOMEvariable and always looks into/home/.ssh/ - MinGW Git built with
makepkg-mingwhardcodes the absolute exec path (e.g.C:/msys64/mingw64/git-core) - it seems that
git ls-remote origin, run from a freshly-built and installed MinGW Git fails to be able to output anything, andgit ls-remote origin | cat(a trick learned from working with old MSys'/MinGW's quirks) only says:output is not a tty(the exit code is 127, suggesting that some executable was not found, but it is very difficult to say which one because not even debug print statements tostderrare shown; It seems that in case of a crash or of adie(),stderris not flushed) - we
#definesomeS_*flags inmingw.hthat mingw-w64's headers already define. This results in tons of compile warnings that might hide valid problems - MSys2's build recipe (called
PKGBUILD; very similar to msysGit's home-brewnrelease.shscripts) lists a dozen patches; We need to determine whether to reject them or whether to integrate them in our Git fork proper) - MSys2 builds Git with
./configurewhile our strategy has always been to enhance the configuration inconfig.mak.uname; We need to decide whether we want to follow the./configurestrategy or rather continue with our tried and tested approach - the
mingw-w64-x86_64-gdbpackage is a 64-bit executable, but handles only 32-bit executables, it seems. This will make debugging substantially harder - we will also need to add support for the
-fflag to MSys2'skillcommand (Note: MSys2'skillalready knows the-fflag, but there is a Bash builtin that takes precedence when callingkillwithout an explicit path, and thatkilldoes not know the-fflag)
I will keep updating this report as I find out more.
Reactions are currently unavailable
Activity
dscho commentedon Feb 13, 2015
Update: to rebuild MinGW
curl, I had to import Daniel Sternberg's (i.e. the main cURL developer's) key into gpg, not into pacman viapacman-key.In other words, I had to call
gpg --keyserver hkp://pgp.mit.edu --recv-keys 78E11C6B279D5C91before runningmakepkg-mingw -sinMINGW-packages'mingw-w64-curl/directory. The symptom that this is needed:dscho commentedon Feb 13, 2015
Another update, this time really dramatic:
In other words, MSys2 has an even worse path translation than MSys... 😦
dscho commentedon Feb 13, 2015
Good news: the funny issue with
git ls-remotegoes away when recompiling myself. It seems that there was some problem with curl, maybe even caused by a version skew.dscho commentedon Feb 13, 2015
Sadly, there are also bad news:
t0001already fails with a Segmentation fault (!!!) when runninggit aliasedinit... It keeps being a challenging project!oysteinkrog commentedon Feb 14, 2015
I just want to let you know that I appreciate your work:)
I use MSYS2 myself and I agree that it is much better than old msys, the main problem for me is that the cygwin-based git is so slow.
If you get mingw-git working it would be awesome.
I tried to look at it myself but it is really very hard, especially if one is not all that experienced with native code and buildsystems.
dscho commentedon Feb 15, 2015
This issue was probably caused by
mingw_startup()not being called in the Git built from MSys2's MinGW Git build script. I will not investigate the issue more because it cannot be reproduced with the Git I built from scratch.Given this insight, I decided that it would be better to stick with our
config.mak.uname-based approach to configure the build (as opposed to the./configure-based method proposed by MSys2'smingw-w64-git).Sidenote: I do plan to offer a PR to MSys2's
MINGW-packagesrepository once I completed my work successfully.The hard crash I saw in
t0001(i.e. when runninggit aliasedinit) was caused byunsetenv()'s not knowing about our UTF-8 environment: when looking up an environment variable, our binary search would try to compare a string againstNULL. I added a commit that errors out explicitly whenNO_UNSETENVis defined and themingw_startup()code is active at the same time.dscho commentedon Feb 15, 2015
Another set of updates: the two most crucial problems I addressed today are:
TZenvironment variable is stripped out by the MSys2 runtime when executing non-MSys2 programs, causing regressions in the test suite. While the rationale is sound (Win32 API treats TZ differently than POSIX), making the information unavailable is not a proper solution. My proposed fix renames the environment variable toMSYS2_TZbefore passing it on to non-MSys2 programs (including Git).~/fileto~C:\msys64\file. My current version of a fix most likely will evolve, but for the moment, we simply skip the conversion when a tilde, a quote or wildcards were found before the first slash or white space character.The current version of my fixes can be seen here: https://github.com/dscho/Cygwin/branches
dscho commentedon Feb 16, 2015
Update: as of last night, the following tests still fail: t0060, t1504, t1506, t1508, t1513, t3300, t3301, t3400, t3404, t3600, t3707, t3902, t4016, t4056, t4135, t4208, t4211, t5000, t5500, t5516, t5570, t5601, t5602, t5801, t6006, t6132, t7201, t7400, t7800, t9001, t9010, t9350, t9700, t9903 and t9300 waits forever.
While this is an impressive list of failures, the number of root causes is likely much smaller. I expect most of the issues to go away with a more careful p2w handling.
dscho commentedon Feb 18, 2015
Progress: after skipping filenames-with-tabs tests explicitly (MSys2 allows you to create such files even if the Win32 API cannot handle them), and after working quite a bit on the posix-to-windows path mangling as well as the environment mangling of MSys2, the list of failing tests shrunk to t3703, t4056, t5000, t5500, t5516, t5570, t5601, t5602, t5801, t7400, t7800, t9001, t9010, t9350, t9700 and t9300 still has five test cases that wait for input on stdin by mistake.
The current patches can be seen here: https://github.com/dscho/Cygwin/compare/git-for-windows and dscho/git@git-for-windows...msys2 (to be cleaned up)
dscho commentedon Feb 20, 2015
A ton of work later, t7800 and 9700 are the only tests that expose problems.
hvoigt commentedon Feb 22, 2015
Wow, @dscho I just have to say: Your work is awesome!
dscho commentedon Feb 22, 2015
t7800 down, t9700 to go.
dscho commentedon Feb 22, 2015
Done. While at it, I also documented packaging a bit more, as well as started describing how to run and debug the regression tests.
5 remaining items
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
virtualfilesystem: fix bug with symlinks being ignored
reftable/reader: introduce refcounting
reftable/reader: introduce refcounting
reftable/reader: introduce refcounting
builtin/history: unuse the commit buffer after use