aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-11-28 03:56:33 +0100
committerSven Gothel <[email protected]>2023-11-28 03:56:33 +0100
commitc8cb87e17a14281a9d0e2f311b8534ecb7ac00b4 (patch)
treedcbce53804b54a224061e24a3217e600f04fc493
parentc7efca6d9b0db7305f5352ebf15d915ae5a1fa24 (diff)
Bug 1474: Allow temp folder for exe-file test to contain parenthesis on Windows
If the temp path contains parenthesis on Windows, e.g. the username or the sub-temp folder, the used exeTestFile.getCanonicalPath() can't be used by 'Runtime.getRuntime().exec( path )'. Example: C:\Users\(ABC)abc\AppData\Local\Temp Output: Exe-Tst: 'C:\Users\' is not recognized as an internal or external command, operable program or batch file. Hence the complete canonical path must be quoted, i.e. Path: "C:\Users\(ABC)abc\AppData\Local\Temp"
-rwxr-xr-xmake/scripts/java-win64.bat1
-rwxr-xr-xmake/scripts/runtest-x64.bat13
-rwxr-xr-xmake/scripts/runtest.sh4
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java8
-rw-r--r--src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java5
5 files changed, 20 insertions, 11 deletions
diff --git a/make/scripts/java-win64.bat b/make/scripts/java-win64.bat
index 26a4591..2f79cbd 100755
--- a/make/scripts/java-win64.bat
+++ b/make/scripts/java-win64.bat
@@ -21,6 +21,7 @@ REM set D_ARGS="-Djogamp.debug.Platform" "-Djogamp.debug.NativeLibrary" "-Djogam
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe" "-Djogamp.debug.IOUtil.Exe.NoStream"
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.TempJarCache" "-Djogamp.debug.IOUtil.Exe" "-Djogamp.gluegen.UseNativeExeFile=true" "-Djava.io.tmpdir=c:\temp_noexec"
REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.TempJarCache" "-Djava.io.tmpdir=c:\temp_noexec"
+REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogamp.debug.IOUtil.Exe" "-Djogamp.debug.TempFileCache" "-Djogamp.debug.TempJarCache"
REM set D_ARGS="-Djogamp.debug=all"
%J2RE_HOME%\bin\java -classpath %CP_ALL% %X_ARGS% %D_ARGS% "-Djava.library.path=%LIB_DIR%" "-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true" %1 %2 %3 %4 %5 %6 %7 %8 %9 > java-win64.log 2>&1
diff --git a/make/scripts/runtest-x64.bat b/make/scripts/runtest-x64.bat
index 21d7f78..b8bd437 100755
--- a/make/scripts/runtest-x64.bat
+++ b/make/scripts/runtest-x64.bat
@@ -1,14 +1,15 @@
-REM set TEMP=C:\Documents and Settings\jogamp\temp-exec
-REM set TMP=C:\Documents and Settings\jogamp\temp-exec
-REM set TEMP=C:\Users\jogamp\temp-exec
-REM set TMP=C:\Users\jogamp\temp-exec
+REM set TEMP=C:\Documents and Settings\test\temp-exec
+REM set TMP=C:\Documents and Settings\test\temp-exec
+REM set TEMP=C:\Users\test\temp-exec
+REM set TMP=C:\Users\test\temp-exec
+REM set TMP=C:\Users\test\(ABC)abc\temp
-REM scripts\java-win64.bat com.jogamp.common.GlueGenVersion
+scripts\java-win64.bat com.jogamp.common.GlueGenVersion
REM scripts\java-win64.bat com.jogamp.common.util.TestVersionInfo
REM scripts\java-win64.bat com.jogamp.gluegen.jcpp.IncludeAbsoluteTest
-scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.TestJCPP
+REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.TestJCPP
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.TestCParser
REM scripts\java-win64.bat com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter
diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh
index ab80674..d6d5a45 100755
--- a/make/scripts/runtest.sh
+++ b/make/scripts/runtest.sh
@@ -137,7 +137,7 @@ function onetest() {
#onetest com.jogamp.common.net.TestUri01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestUri02Composing 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestUri03Resolving 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908 2>&1 | tee -a $LOG
+onetest com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestAssetURLConnectionUnregistered 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestAssetURLConnectionRegistered 2>&1 | tee -a $LOG
#onetest com.jogamp.junit.sec.TestSecIOUtil01 2>&1 | tee -a $LOG
@@ -171,7 +171,7 @@ function onetest() {
#onetest com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test1p2LoadJNIAndImplLib 2>&1 | tee -a $LOG
-onetest com.jogamp.gluegen.test.junit.generation.Test1p2DynamicLibraryBundle 2>&1 | tee -a $LOG
+#onetest com.jogamp.gluegen.test.junit.generation.Test1p2DynamicLibraryBundle 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test2p1FuncPtr 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test2p2FuncPtr 2>&1 | tee -a $LOG
#onetest com.jogamp.gluegen.test.junit.generation.Test3p1PtrStorage 2>&1 | tee -a $LOG
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index e68c3b3..e9bf050 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -1033,6 +1033,7 @@ public class IOUtil {
final long t0 = debug ? System.currentTimeMillis() : 0;
final File exeTestFile;
+ String exeNativePath;
final boolean existingExe;
try {
final File permExeTestFile = DEBUG_EXE_EXISTING_FILE ? new File(dir, "jogamp_exe_tst"+getExeTestFileSuffix()) : null;
@@ -1044,6 +1045,7 @@ public class IOUtil {
existingExe = false;
fillExeTestFile(exeTestFile);
}
+ exeNativePath = "\""+exeTestFile.getCanonicalPath()+"\"";
} catch (final SecurityException se) {
throw se; // fwd Security exception
} catch (final IOException e) {
@@ -1072,7 +1074,7 @@ public class IOUtil {
// Using 'Process.exec(String[])' avoids StringTokenizer of 'Process.exec(String)'
// and hence splitting up command by spaces!
// Note: All no-exec cases throw an IOExceptions at ProcessBuilder.start(), i.e. below exec() call!
- pr = Runtime.getRuntime().exec( getExeTestCommandArgs( exeTestFile.getCanonicalPath() ), null, null );
+ pr = Runtime.getRuntime().exec( getExeTestCommandArgs( exeNativePath ), null, null );
if( DEBUG_EXE && !DEBUG_EXE_NOSTREAM ) {
new StreamMonitor(new InputStream[] { pr.getInputStream(), pr.getErrorStream() }, System.err, "Exe-Tst: ");
}
@@ -1089,7 +1091,7 @@ public class IOUtil {
t2 = debug ? System.currentTimeMillis() : 0;
res = -3;
if( debug ) {
- System.err.println("IOUtil.testDirExec: <"+exeTestFile.getAbsolutePath()+">: Caught "+t.getClass().getSimpleName()+": "+t.getMessage());
+ System.err.println("IOUtil.testDirExec: <"+exeNativePath+">: Caught "+t.getClass().getSimpleName()+": "+t.getMessage());
t.printStackTrace();
}
} finally {
@@ -1115,7 +1117,7 @@ public class IOUtil {
}
if( debug ) {
final long t3 = System.currentTimeMillis();
- System.err.println("IOUtil.testDirExec(): test-exe <"+exeTestFile.getAbsolutePath()+">, existingFile "+existingExe+", isNioExec "+isNioExec+", returned "+exitValue);
+ System.err.println("IOUtil.testDirExec(): test-exe <"+exeNativePath+">, existingFile "+existingExe+", isNioExec "+isNioExec+", returned "+exitValue);
System.err.println("IOUtil.testDirExec(): abs-path <"+dir.getAbsolutePath()+">: res "+res+" -> "+ok);
System.err.println("IOUtil.testDirExec(): total "+(t3-t0)+"ms, create "+(t1-t0)+"ms, fill "+(t2-t1)+"ms, execute "+(t3-t2)+"ms");
}
diff --git a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
index 3b3cc6f..f3e9970 100644
--- a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
+++ b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
@@ -110,6 +110,11 @@ public class TestUri99LaunchOnReservedCharPathBug908 extends SingletonJunitCase
*/
}
+ @Test
+ public void test02TempJarCacheOddPath() throws IOException, IllegalArgumentException, URISyntaxException {
+ // Bug 1474, issues w/ windows file path char: ( )
+ testTempJarCacheOddJarPathImpl("Users/(ABC)abc/AppData/Local/Temp/");
+ }
private void testTempJarCacheOddJarPathImpl(final String subPathUTF) throws IOException, IllegalArgumentException, URISyntaxException {
if(AndroidVersion.isAvailable) { System.err.println("n/a on Android"); return; }