From c9e8e1e90c21d20634b96f054e30a595ac3a4817 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 24 Apr 2013 17:39:46 -0400 Subject: [PATCH] Fix Autotools for options with round brackets. - Extending fix for Bug 403946 to include options as well Change-Id: I5260f2b10ef38ea0f52b976c20cd8c8f92f1a5d1 Reviewed-on: https://git.eclipse.org/r/12171 Reviewed-by: Jeff Johnston IP-Clean: Jeff Johnston Tested-by: Jeff Johnston --- .../autotools/core/AutotoolsNewMakeGenerator.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 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 19ce6a231c3..ae7c4b16266 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 @@ -1014,8 +1014,6 @@ 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)) { @@ -1025,12 +1023,17 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { s = s.replaceAll("^([A-Z])(:)", "/$1"); } } - s = s.replaceAll("\\\\", "\\\\\\\\"); - s = s.replaceAll("\\(", "\\\\("); - s = s.replaceAll("\\)", "\\\\)"); return s; } + // Fix any escape characters in sh -c command arguments + private String fixEscapeChars(String s) { + s = s.replaceAll("\\\\", "\\\\\\\\"); + s = s.replaceAll("\\(", "\\\\("); + s = s.replaceAll("\\)", "\\\\)"); + return s; + } + // Run an autotools script (e.g. configure, autogen.sh, config.status). private int runScript(IPath commandPath, IPath runPath, String[] args, String jobDescription, String errMsg, IConsole console, @@ -1088,7 +1091,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { // fix for bug #356278 if (resolved.length() > 0 && resolved.charAt(0) != '-') resolved = stripEnvVarsFromOption(resolved, additionalEnvs); - configTargets[i] = resolved; + configTargets[i] = fixEscapeChars(resolved); } catch (BuildMacroException e) { } }