Skip to content

Commit

Permalink
Merge pull request #95 from rimrul/arm64-bash-fix
Browse files Browse the repository at this point in the history
ARM64: fix `/bin/bash.exe` and `/bin/sh.exe` not starting
  • Loading branch information
rimrul authored Oct 20, 2023
2 parents a27cc2b + 0c91cf2 commit e32d5db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions mingw-w64-git/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-${_realname}-test-artifacts")
tag=2.42.0.windows.2
pkgver=2.42.0.2.2f819d1670
pkgrel=1
pkgrel=2
pkgdesc="The fast distributed version control system (mingw-w64)"
arch=('any')
url="https://git-for-windows.github.io/"
Expand Down Expand Up @@ -61,7 +61,7 @@ sha256sums=('SKIP'
'a9dcba5aebc93ae7aacdee03275780fc6c0f15e88fda30c93041e75851e75090'
'f16b345aba17acd124ab5940635dfa2d87445df73eedbeb80e0285f29c85415a'
'80b0b11efe5a2f9b4cd92f28c260d0b3aad8b809c34ed95237c59b73e08ade0b'
'a5722c42c4b6c1e11ffb940d8c8f04956bb40c050c92f1c3f604145252679279'
'20613488bbd66bced2ef786448dc335c9cc7a5ef8be800e0d5bab83e36faf584'
'dab3e41e935a33f443a4ff4ef4ce92c191b6d952d9eb37e14885540ad5af99ed'
'c975292adae1f2666f07f8ee9b7d50576da249d9151c6bd211602adc8d37b6ab'
'53e630f581bee400100d074189754413afb6670ba1c09a5a3a09c5b575e41e60'
Expand Down
30 changes: 19 additions & 11 deletions mingw-w64-git/git-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void my_path_append(LPWSTR list, LPCWSTR path, size_t alloc)

static int running_on_arm64 = -1;

static int is_running_on_arm64(LPWSTR top_level_path, LPWSTR msystem_bin)
static int is_running_on_arm64_hardware()
{
if (running_on_arm64 >= 0)
return running_on_arm64;
Expand All @@ -133,19 +133,27 @@ static int is_running_on_arm64(LPWSTR top_level_path, LPWSTR msystem_bin)
IsWow64Process2(GetCurrentProcess(), &process_machine, &native_machine) &&
native_machine == 0xaa64;

if (running_on_arm64) {
size_t len = wcslen(top_level_path);
return running_on_arm64;
}

/* Does /clangarm64/bin exist? */
my_path_append(top_level_path, L"clangarm64/bin", MAX_PATH);
if (_waccess(top_level_path, 0) != -1)
wcscpy(msystem_bin, L"clangarm64/bin");
else
running_on_arm64 = 0;
top_level_path[len] = L'\0';
static int is_running_on_arm64_msystem(LPWSTR top_level_path, LPWSTR msystem_bin)
{
int ret=0;
size_t len = wcslen(top_level_path);

/* Does /clangarm64/bin exist? */
my_path_append(top_level_path, L"clangarm64/bin", MAX_PATH);
if (_waccess(top_level_path, 0) != -1) {
wcscpy(msystem_bin, L"clangarm64/bin");
ret=1;
}
top_level_path[len] = L'\0';
return ret;
}

return running_on_arm64;
static inline int is_running_on_arm64(LPWSTR top_level_path, LPWSTR msystem_bin)
{
return is_running_on_arm64_hardware() && is_running_on_arm64_msystem(top_level_path, msystem_bin);
}

static int is_system32_path(LPWSTR path)
Expand Down

0 comments on commit e32d5db

Please sign in to comment.