Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2987: Fixing a few launch issues (#4872, Closes #4893)

Ryan Kurtzaf042aa2d158
diff --git a/Ghidra/RuntimeScripts/Linux/support/launch.sh b/Ghidra/RuntimeScripts/Linux/support/launch.sh
index 665cd4a4c3..92baf3703f 100755
--- a/Ghidra/RuntimeScripts/Linux/support/launch.sh
+++ b/Ghidra/RuntimeScripts/Linux/support/launch.sh
@@ -145,7 +145,7 @@ fi
JAVA_CMD="${JAVA_HOME}/bin/java"
# Get the configurable VM arguments from the launch properties
-while IFS= read -r line; do
+while IFS=$'\r\n' read -r line; do
VMARGS_FROM_LAUNCH_PROPS+=("$line")
done < <(java -cp "${LS_CPATH}" LaunchSupport "${INSTALL_DIR}" -vmargs)
diff --git a/Ghidra/RuntimeScripts/Windows/support/launch.bat b/Ghidra/RuntimeScripts/Windows/support/launch.bat
index d566ecd91b..bd2b6c9001 100644
--- a/Ghidra/RuntimeScripts/Windows/support/launch.bat
+++ b/Ghidra/RuntimeScripts/Windows/support/launch.bat
@@ -129,7 +129,7 @@ if "%JAVA_HOME%" == "" (
set "JAVA_CMD=%JAVA_HOME%\bin\java"
:: Get the configurable VM arguments from the launch properties
-for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -vmargs') do set VMARG_LIST=%VMARG_LIST% %%i
+for /f "delims=*" %%i in ('java -cp "%LS_CPATH%" LaunchSupport "%INSTALL_DIR%" -vmargs') do set VMARG_LIST=!VMARG_LIST! %%i
:: Set Max Heap Size if specified
if not "%MAXMEM%"=="" (
diff --git a/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java b/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java
index a2df286c51..b0e72f23af 100644
--- a/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java
+++ b/GhidraBuild/LaunchSupport/src/main/java/LaunchSupport.java
@@ -291,7 +291,8 @@ public class LaunchSupport {
return EXIT_FAILURE;
}
- javaConfig.getLaunchProperties().getVmArgList().forEach(arg -> System.out.println(arg));
+ // Force newline style to make cross-platform parsing consistent
+ javaConfig.getLaunchProperties().getVmArgList().forEach(e -> System.out.print(e + "\r\n"));
return EXIT_SUCCESS;
}
}