-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Get the BusyBox-based MinGit production-ready #1439
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
Comments
@dscho I'm interested in this, especially to reduce/avoid the dependency on MSYS2/Cygwin. How can others help? |
Mostly by testing in as close to production as you dare ;-) I vaguely remember that there have been some inexplicable hangs when I tried to run the test suite (I used |
I am sorry to hear that. But I also have to say that I have a hard time understanding what exactly the problem is. Care to explain in any sort of detail? |
The Anaconda Distribution has been trying to use busybox Git for Windows and ran into a problem with git submodule hanging:
I added
|
I see a commandline of |
Switching the |
Sorry for the late reply. I am still struggling to find any time for any serious work on BusyBox. This comment makes me believe that the hang is caused by the patches I introduced on top of BusyBox-w32, and that's what most likely also causes the so far unexplained hangs in the test suite I observed. |
@dscho is there a particular build we should be helping with testing if this has accidentally resolved itself, or should we hold off for the moment? |
No problem at all @dscho there's only so many hours in a day. |
@shiftkey Sadly, there is no chance of this being resolved accidentally... @mingwandroid thanks for understanding! |
I actually found busybox mingit to be more usable by end-user than regular mingit, as you can simply run |
I don't believe |
it has However, it is not usable as an interactive shell, cause there is no Update, path is set if I call In addition, mingit busybox has broken Unicode support (probably expected given it took a few versions to get unicode support in MSYS). |
MinGit is not intended to be used interactively, skipping a ton of parts in the quest to minimize the footprint for applications which want to ship with Git. Any interactive functionality you use in MinGit (BusyBox variant or not) might go away at any stage, without prior warning (apart from this here stern one). |
I am increasingly annoyed by the fact that Git-bash behavior is just so special that commands which are intended to work both in As far as I am concerned, I don't need the full power of bash on Windows, or the path conversion, or the terminal emulation. I only want to native Windows applications in a native Windows terminal. On the other hand, I just can't get used to cmd.exe or PowerShell because I am so addicted to basic command line editing shortkeys like ctrl-p, ctrl-n, ctrl-a, ctrl-e, alt-b, alt-f, alt-w, alt-d, and maybe also ctrl-z and ctrl-r. I think it would be huge if we can rid Git-for-Windows of the complexity induced by the MSYS2/Cygwin emulation layer (both runtime and terminal emulation) and replace it with Windows native code. Why do we consider BusyBox only for MinGit, but not as a replacement for MSYS2/Cygwin/Git-bash? Ignoring backwards compatibility for now, what would be the minimum requirements for such a replacement? Do we need more than the following:
|
Note that BusyBox comes with its own
Also, please note that BusyBox supports Ctrl+R, but not Ctrl+Z. Further, BusyBox-w32 has troublesome performance issues, at least currently. In theory it should be a lot faster to execute shell scripts using BusyBox' ash than using MSYS2's Bash. In practice, it seems to be the opposite. My guess is that the way the forkshell emulation is implemented is suboptimal, and leaves a lot of room for improvement. Finally, let's not forget that Git advertises scripting as the way to make things work. Hooks are strongly expected to be shell scripts. And those shell scripts are definitely outside of the control of Git's own source code, so we would quite likely break power users' scripts by simply switching to BusyBox, as most of its commands/options are noticeably limited compared to the full commands. So I think that the best we can do is to offer an opt-in to BusyBox. After making it work. Robustly so. |
FWIW, I am now happy with Clink, which effectively adds readline capabilities to cmd.exe. |
There must be a compatible |
Diffutils shipped with mingit-busybox |
Some helper scripts like |
I hope that we will get a chance to resolve this more elegantly, e.g. by some magic
Right! We do have a script to check for missing
Porting the Pipeline should be relatively easy: just use the printf 'Checking full file list\n\n' >&2
./check-for-missing-dlls.sh | tee full.txt
printf '\n\nChecking MinGit file list\n\n' >&2
MINIMAL_GIT=1 ./check-for-missing-dlls.sh | tee min.txt
! grep ' is missing ' full.txt min.txt
! grep -i 'unused ' min.txt
I am not that sure about |
I've find two large executable with the same content. Can one of them be a wrapper to another?
|
We would have to teach the |
In mingit-busybox, msys executable inside
So here comes a crazy idea: completely remove msys part, provide Win32-Openssh or even ask users to download it themselves (sinve 1809, Windows10 bundles it). The only keypoint is that how many software depend on msys |
That looks like an oversight on my part, too. There are parts of Git that depend on Tcl, but they also depend on Tk because they are
Good point.
That might be an option if we did not support Windows Vista, still. But I give you this: it is tempting an idea. And I have thought about it a lot. But for that, we definitely need to work a lot harder on BusyBox-w32. We do not have any current build of |
In msys2/MSYS2-packages@325eedfc14 (a rather monster-type of a huge change), the build-time dependency `tcl` was upgraded to a full-scale runtime dependency of all SQLite packages, including `libsqlite`. This is most likely a bug (which was easy to miss, given the amount of changes accumulated in that big patch), as `tcl` is still marked as a runtime dependency of the `tcl-sqlite` package (which is still correct). But `tcl` is not required to use `libsqlite`, which `openssh` does, and therefore we now have this useless baggage we have to shlep around. Let's exclude it manually. Noticed in git-for-windows/git#1439 (comment) Signed-off-by: Johannes Schindelin <[email protected]>
I believe that I addressed the |
After a looong hiatus, I upgraded to the latest BusyBox-w32 tag, integrated a CI build, and the Pipeline to build the |
As announced in https://github.com/git-for-windows/git/releases/tag/v2.36.1.windows.1, we can make it true now.
|
I am not so sure about that. |
It would seem that I never have enough time to push this through, and there are still substantial hurdles:
Nevertheless, I think it would be valuable to enhance the current state by:
In short: There is a lot to do, and the more hands help, the quicker it will get done. |
This is mostly an old discussion, but I wanted to share maybe some new info about the issues raised here. As background, I use both (pure) cygwin and busybox-w32 as daily-driver in interactive environments, regardless of git, and I do contribute to bb-w32 occasionally. As for git, I use the minigit busybox package, but with own bb-w32 build for about 2 years and didn't notice issues, though that's only an anecdote. The goal is to hopefully make it clearer what still stands in the way and what not when trying to use bb-w32 instead of msys2 and its utilities - to the best of my knowledge. This is not an attempt to convince anyone that busybox-w32 is the way to go. I'm also speaking exclusively about bb-w32 and msys2/cygwin, and not comparing it to alternative solutions or shells (which may indeed be better). First, perl obviously needs another solution outside of busybox as long as it's required. I also agree that bb-w32 CI would be good to have. As for bb-w32 issues raised above, hopefully in order of appearance:
Another subject which I think was not mentioned is long file names: I believe gfw-bb-w32 does increase the possible path lengths at least in some cases, IIRC to 4K or some such. Upstream bb-w32 doesn't have it. I believe it uses PATH_MAX or some such with some file buffers, which is ~ 260 (if it's a long argument then it remains long, but IIRC code which reads a path via win32 api only uses PATH_MAX buffer). As for being slower than bash/msys2-utils, it's definitely possible, but it also highly depends on the use case. Generally speaking, from my own experience with interactive cygwin and bb-w32 daily, I've feel that bb-w32 scripts/utils perform similar or better than cygwin/msys2. Scripting at least is generally faster than bash. Subshells performance might differ (I didn't compare those), but any script which somewhat cares about performance should try reasonably to avoid them unless necessary - same goes on BSD and even on linux (which is known for its blazing fast exec/fork performance, and subshells still matter a lot in scripts, but orders of magnitude less than on windows). If any specific (sh) script is known to perform slower than desired, I don't mind having a look if someone points it out. |
Cygwin (and hence MSYS2, which is a derivative) tries to emulate POSIX functionality on top of the Win32 API. When spawning child processes, this means that
fork()
needs to be emulated, which is hard, and requires the MSYS2 runtime's address range to be pinned. This leads to many a problem on many, many setups sometimes even only after unrelated software is upgraded!Git for Windows uses the MSYS2 runtime essentially for two things: SSH and Unix shell/Perl scripting.
In MinGit, we already do not include any Perl scripts. But plenty of Unix shell scripts. Ideally, those would be converted into "builtins", i.e. pure, portable, performant C, which would make everything quite a bit more robust, not to mention fast. Sadly, this is no priority of core Git's developers/maintainer and it is a lot of work.
To side-step this, we put in quite an effort last year to ship a "BusyBox-based" variant of MinGit. BusyBox is an executable that offers minimal versions of many Unix tools, such as a Unix shell,
sed
,awk
, etc, in a single binary (much likegit.exe
includes many subcommands as "builtins"), and there exists a pure Win32 version of BusyBox that we helped along until it could run Git's Unix shell scripts and test suite.It is time to get this BusyBox-based MinGit to a point where it is robust enough to be the default MinGit.
The text was updated successfully, but these errors were encountered: