From 2382edbcee01cd5842f1c04e28a0c3c9d57eb6bd Mon Sep 17 00:00:00 2001 From: Yann Hodiesne Date: Fri, 1 Apr 2022 12:10:49 +0200 Subject: [PATCH 1/4] Clean up Fork.RI --- resources/Fork.RI | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/Fork.RI b/resources/Fork.RI index 9206848..bd4d39c 100755 --- a/resources/Fork.RI +++ b/resources/Fork.RI @@ -3,7 +3,7 @@ # converted to a windows path. # Expects the environment variable FORK_RI_EXE_PATH to contain the path to Fork.RI.exe. -UNAME=$(uname -a) +UNAME="$(uname -a)" # 'uname -a' returns: # WSL1: Linux PCNAME 4.4.0-17134-Microsoft #706-Microsoft Mon Apr 01 18:13:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux # WSL2: Linux DESKTOP-4P30KCU 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux @@ -13,12 +13,12 @@ UNAME=$(uname -a) if [[ $UNAME == *icrosoft* ]]; then # in a wsl shell - WSL_BUILD=$(sed -E 's/^.+-([0-9]+)-Microsoft.*/\1/' <<< $UNAME) - if [ -z $WSL_BUILD ]; then + WSL_BUILD=$(sed -E 's/^.+-([0-9]+)-Microsoft.*/\1/' <<< "$UNAME") + if [ -z "$WSL_BUILD" ]; then WSL_BUILD=0 fi - if [ $WSL_BUILD -ge 17046 || ! -z $WSL_INTEROP ]; then + if [ $WSL_BUILD -ge 17046 ] || [ -n "$WSL_INTEROP" ]; then # WSLPATH is available since WSL build 17046 # Make sure that Fork.RI.exe is executable. From bf04e16bed568e8bd6ab8e014f0b7743d14bfdce Mon Sep 17 00:00:00 2001 From: Yann Hodiesne Date: Fri, 1 Apr 2022 12:41:46 +0200 Subject: [PATCH 2/4] Add support for WSL2 build version checks --- resources/Fork.RI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/Fork.RI b/resources/Fork.RI index bd4d39c..f486647 100755 --- a/resources/Fork.RI +++ b/resources/Fork.RI @@ -13,7 +13,7 @@ UNAME="$(uname -a)" if [[ $UNAME == *icrosoft* ]]; then # in a wsl shell - WSL_BUILD=$(sed -E 's/^.+-([0-9]+)-Microsoft.*/\1/' <<< "$UNAME") + WSL_BUILD=$(cmd.exe /c "systeminfo" | grep -E -i "build [0-9]+" | sed -E 's/^.*build ([0-9]+).*$/\1/') if [ -z "$WSL_BUILD" ]; then WSL_BUILD=0 fi From 59b6ffc9382041ec07b458d62a4dbd336b01cb22 Mon Sep 17 00:00:00 2001 From: Yann Hodiesne Date: Fri, 1 Apr 2022 14:25:50 +0200 Subject: [PATCH 3/4] Fix Windows short paths usage with Fork --- resources/Fork.RI | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/Fork.RI b/resources/Fork.RI index f486647..fd97da6 100755 --- a/resources/Fork.RI +++ b/resources/Fork.RI @@ -21,6 +21,13 @@ if [[ $UNAME == *icrosoft* ]]; then if [ $WSL_BUILD -ge 17046 ] || [ -n "$WSL_INTEROP" ]; then # WSLPATH is available since WSL build 17046 + # Make sure that FORK_RI_EXE_PATH does not contain any badly escaped spaces. + # It can happen when using Windows' short paths inside Fork's custom git instance path + # Example: Fork is configured with "C:\Users\SURNAM~1\wslgit\bin\git.exe" instead of "C:\Users\Surname Lastname\wslgit\bin\git.exe" + # which may be a valid use case as is does not support spaces in paths. + # FORK_RI_EXE_PATH would contain "/mnt/c/Users/Surname/ Lastname/wslgit/bin/Fork.RI.exe" before the following sed call + FORK_RI_EXE_PATH="$(sed 's/\/ / /g' <<< "$FORK_RI_EXE_PATH")" + # Make sure that Fork.RI.exe is executable. chmod +x "$FORK_RI_EXE_PATH" From 06bed04f1ade446dbf25ed55002b1758343ae65d Mon Sep 17 00:00:00 2001 From: Yann Hodiesne Date: Mon, 2 May 2022 09:23:30 +0200 Subject: [PATCH 4/4] Fix build version parsing Made it case insensitive to ensure it works under all locales --- resources/Fork.RI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/Fork.RI b/resources/Fork.RI index fd97da6..7620d6f 100755 --- a/resources/Fork.RI +++ b/resources/Fork.RI @@ -13,7 +13,7 @@ UNAME="$(uname -a)" if [[ $UNAME == *icrosoft* ]]; then # in a wsl shell - WSL_BUILD=$(cmd.exe /c "systeminfo" | grep -E -i "build [0-9]+" | sed -E 's/^.*build ([0-9]+).*$/\1/') + WSL_BUILD=$(cmd.exe /c "systeminfo" | grep -E -i "build [0-9]+" | sed -E 's/^.*build ([0-9]+).*$/\1/I') if [ -z "$WSL_BUILD" ]; then WSL_BUILD=0 fi