From 890eea5813bb961b2c562737f366f9ea6dfcb075 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 23 Apr 2013 18:41:09 -0400 Subject: [PATCH] Bug 403946: Autotools configure does not handle round brackets in workspace name - Add backslashes to special characters such as round brackets when computing the command path. Change-Id: I3bf0d78fc8e0a94c6287a7fae00a469ecdad6dc1 Reviewed-on: https://git.eclipse.org/r/11921 Reviewed-by: Jeff Johnston IP-Clean: Jeff Johnston Tested-by: Jeff Johnston --- .../core/AutotoolsNewMakeGenerator.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java index 7ee53d262f5..19ce6a231c3 100644 --- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java +++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java @@ -853,6 +853,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { ConsoleOutputStream consoleOutStream = null; + ErrorParserManager epm = null; StringBuffer buf = new StringBuffer(); // Launch command - main invocation @@ -891,7 +892,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // Hook up an error parser manager URI uri = URIUtil.toURI(runPath); - ErrorParserManager epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); + epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); epm.setOutputStream(consoleOutStream); epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath())); @@ -968,13 +969,17 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // Write message on the console consoleOutStream.write(buf.toString().getBytes()); consoleOutStream.flush(); + // // Generate any error markers that the build has discovered // monitor.subTask(ManagedMakeMessages // .getResourceString(MARKERS)); // epm.reportProblems(); } finally { - consoleOutStream.close(); + if (consoleOutStream != null) + consoleOutStream.close(); + if (epm != null) + epm.close(); } // If we have an error and no specific error markers, use the default error marker. @@ -1009,6 +1014,8 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // Get the path string. We add a Win check to handle MingW. // For MingW, we would rather represent C:\a\b as /C/a/b which // doesn't cause Makefile to choke. For Cygwin we use /cygdrive/C/a/b + // Add backslashes to escape any special characters in the command path + // that will give the shell distress (e.g. runtime-New_Configuration(1)). private String getPathString(IPath path) { String s = path.toString(); if (Platform.getOS().equals(Platform.OS_WIN32)) { @@ -1018,6 +1025,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { s = s.replaceAll("^([A-Z])(:)", "/$1"); } } + s = s.replaceAll("\\\\", "\\\\\\\\"); + s = s.replaceAll("\\(", "\\\\("); + s = s.replaceAll("\\)", "\\\\)"); return s; } @@ -1091,6 +1101,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { ConsoleOutputStream consoleOutStream = null; + ErrorParserManager epm = null; StringBuffer buf = new StringBuffer(); // Launch command - main invocation @@ -1149,7 +1160,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // Hook up an error parser manager URI uri = URIUtil.toURI(runPath); - ErrorParserManager epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); + epm = new ErrorParserManager(project, uri, this, new String[] {ErrorParser.ID}); epm.setOutputStream(consoleOutStream); epm.addErrorParser(ErrorParser.ID, new ErrorParser(getSourcePath(), getBuildPath())); @@ -1233,7 +1244,10 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // .getResourceString(MARKERS)); // epm.reportProblems(); } finally { - consoleOutStream.close(); + if (consoleOutStream != null) + consoleOutStream.close(); + if (epm != null) + epm.close(); } // If we have an error and no specific error markers, use the default error marker.