-
Notifications
You must be signed in to change notification settings - Fork 615
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
Feature/update git bash string resource editor #118
Feature/update git bash string resource editor #118
Conversation
It appears some commit messages could use a bit of "fine tuning" to be a bit more accurate. |
Would you mind signing off on the patches? I am not quite sure we would want to specify an output directory, but rather move the Other than that, I really like this PR! |
Thanks! I'll make the suggested changes and sign off on everything. |
@dscho: Since you want me to change |
I think we can keep the But now that I come to think of it: it is really dirty to use a precompiled What do you think? |
I think I agree that both the DLL and EXE should be compiled as part of the release process. When changes were made to I was having trouble making it cross-compile. The Makefile isn't set up for that (it doesn't work on my machine, anyway), and I'm even having trouble trying to do it manually. I didn't check the I don't think it makes much of a difference whether we use the EXE or the DLL in the InnoSetup installer. If we use the EXE, could we retain the |
The |
This seems to work for me: diff --git a/installer/Makefile b/installer/Makefile
index 73737e1..89de752 100644
--- a/installer/Makefile
+++ b/installer/Makefile
@@ -4,7 +4,8 @@ DLLINKFLAGS=-Wl,--kill-at -static-libgcc -shared
all: edit-git-bash.dll
edit-git-bash.dll: edit-git-bash.c
- gcc $(CFLAGS) $(DLLINKFLAGS) -o $@ $^
+ PATH=/mingw32/bin:$$PATH \
+ i686-w64-mingw32-gcc -march=i686 $(CFLAGS) $(DLLINKFLAGS) -o $@ $^
edit-git-bash.exe: edit-git-bash.c
gcc -DSTANDALONE_EXE $(CFLAGS) -o $@ $^ (I have not tested the
I think we should be able to use it; We use the |
Thanks, I'll check it out.
The DLL is never copied to disk, it's loaded into memory by the installer process and the method within is exported. To my knowledge, there's nothing preventing a EXE from exporting functions, so it might work. I'll give it a try. The worst that could happen is it doesn't work. Well, my knowledge was (mostly) wrong. I think I'm going to go with the path of least resistance: keep using |
Thanks @dscho, it compiled. I should've known it was that simple. I'll do a few tests to make sure everything works ok. |
The InnoSetup installer requires `edit-git-bash.c` to be compiled to a DLL, though currently, this is not compiled as part of the overall release process. This DLL is used by the installer to modify the `git-bash.exe` string resources responsible for starting the terminal emulator for hosting the BASH. It comes into play when the installing user chooses to use the standard Windows Command Console over the default mintty terminal emulator. The new MSI installer also needs a way to modify `git-bash.exe` string resources to achieve the same effect. The easiest way to accomplish this is to compile `edit-git-bash.c` as an EXE and use a custom action to call the `edit-git-bash.exe` to modify `git-bash.exe`. Therefore, this commit moves the make file and `edit-git-bash.c` to the top-level `build-extra` directory since it's a resource now required by more than one installer. Likewise, the .gitignore has been updated to ignore `edit-git-bash.dll` and `edit-git-bash.exe`. Signed-off-by: Craig E. Shea <[email protected]>
Signed-off-by: Craig E. Shea <[email protected]>
When this developer compiled `edit-git-bash.c` to an EXE, `edit-git-bash.exe` did not behave as expected. Two string tables appeared in the resources section of the resulting `git-bash.exe` executable. Furthermore, this did _not_ occur when installing Git for Windows 2.7.2 using the InnoSetup installer on a test VM. However, this developer did confirm a problem with this program. When installing Git for Windows 2.7.2 and choosing the Windows Command Console as the terminal emulator, the string resources for `git-bash.exe` were updated. In fact, all resources were wiped out of `git-bash.exe` and a new STRINGTABLE resource was created containing the command to execute to start the BASH shell in a Windows Command Console. Resources that were wiped out included the Git for Windows icons that are embedded in the `git-bash.dll` (the file size went from 137KB to 28KB). This appears to be due to the fact that 1. This DLL is not recompiled from source whenever an installer is generated 2. The existing `edit-git-bash.dll` was compiled from an earlier version of the source which replaced resources instead of just updating them When this developer compiled the current source of `edit-git-bash.c` and proceeded to run the resulting EXE on `git-bash.exe`, `git-bash.exe` now contained two string tables in its resources section of the executable, both with ID 1. How can this be? It turns out the original `git-bash.exe` string table resources were added using LCID 1033 (0x0409 a/k/a en-US locale). The EXE produced by the current `edit-git-bash.c` updated `git-bash.exe` resources using the LCID 1024 (0x0400, language-neutral, default sub-language). Since the source code is now _updating_ the resources, and not replacing them, the net effect was to add a second string table. Apparently, then, string table are uniquely identified by their ID and (at least) their locale. Why does this matter? Because my computer is set to LCID 1033 (en-US), so when `git-bash.exe` was executed, it used the original string resources (the one matching my current computer's Locale) and started the BASH in mintty, not the Windows Command Console. Furthermore, when looking at the embedded resources for the installation of Git for Windows 2.7.2 set to use the Windows Command Console for the BASH, it worked correctly even though the string resources were for LCID 1024 (the neutral locale). That's because there was only one STRINGTABLE, (since the resources in that version of the DLL were being completely replaced) and the neutral locale is the fallback locale. Since a string table resource for LCID 1033 could not be found, the neutral resources were used, resulting in correct behavior. This commit, then, changes the updating of the string resources in `git-bash.exe` such that the new string resources are written in LCID 1033, just as the original resources of `git-bash.exe` are. This will prevent additional string table resources (in different locales) from being created and ensure that the proper resources are updated, resulting in correct behavior. Signed-off-by: Craig E. Shea <[email protected]>
33f8d98
to
e22d6b2
Compare
@dscho: Could I borrow your eyes once more? 😄 Just a note: I plan on making more changes to |
edit-git-bash.dll: edit-git-bash.c | ||
gcc $(CFLAGS) $(DLLINKFLAGS) -o $@ $^ | ||
PATH=/mingw32/bin:$$PATH \ | ||
i686-w64-mingw32-gcc -march=i686 $(CFLAGS) $(DLLINKFLAGS) -o $@ $^ |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
e22d6b2
to
fcb1446
Compare
s/in/is/ |
CC = PATH=/mingw32/bin:$$PATH i686-w64-mingw32-gcc -march=i686 | ||
endif | ||
endif | ||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Good work! As I said in the comments, I'd prefer to hardcode the (cross-)compiler in the After that, I think this PR is ready to go! |
The Makefile was modified to ensure that `edit-git-bash.c` is always compiled as a 32-bit DLL when the `edit-git-bash.dll` target is invoked. InnoSetup is only 32-bit "aware", so even for the 64-bit distribution, a 32-bit DLL needs to be used. The InnoSetup `release.sh` script was updated to include building `edit-git-bash.dll`. The rendering of release notes was moved until after all argument processing; this also had the advantage of placing the call to `make` directly after it--these activities are sort of "pre-processing" before the actual generation of the installer and made logical sense to this developer. Lastly, the `install.iss` file was updated to source the DLL from it's new location in `build-extra`; the old edit-git-bash.dll in the `installer` directory was deleted. Signed-off-by: Craig E. Shea <[email protected]>
fcb1446
to
8710041
Compare
@dscho: OK, fixed that commit message typo and reverted to the last |
Excellent! Thank you so much! |
When configuring Git Bash with Windows' default console, it [no longer loses its icon](#118). Signed-off-by: Johannes Schindelin <[email protected]>
@dscho: Could you please look this over?
Makefile
andedit-git-bash.c
tobuild-extra
since both InnoSetup and MSI installers require this to editgit-bash.exe
string resources.edit-git-bash.{dll,exe}
update string resources using the originalgit-bash.exe
locale of LCID 1033 (0x0409, a/k/a en-US).