From 6272193b34f8977aad28e956269507dc0fd32e79 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 30 Mar 2012 17:59:58 -0400 Subject: [PATCH] Update Autotools core with missing fixes made after initial move. - Bug 371277 [autotools] - use sh -c to run scripts - Bug 372557 [autotools] - out of range exception on unknown env var --- .../org.eclipse.cdt.autotools.core/ChangeLog | 14 +++++++ .../core/AutotoolsNewMakeGenerator.java | 40 ++++++++++++------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/build/org.eclipse.cdt.autotools.core/ChangeLog b/build/org.eclipse.cdt.autotools.core/ChangeLog index 7e2dab6a3b2..11ff4a875f8 100644 --- a/build/org.eclipse.cdt.autotools.core/ChangeLog +++ b/build/org.eclipse.cdt.autotools.core/ChangeLog @@ -1,3 +1,17 @@ +2012-03-30 Jeff Johnston + + Bug #371277 + * src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java + (regenerateMakefiles): Fix setting of status on error. + (runScript): Switch to use sh -c for all script execution. + +2012-03-30 Jeff Johnston + + Bug #372557 + * src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java + (runScript): Fix index out of range exception when environment variable is + unknown. + 2012-03-29 Jeff Johnston * src/org/eclipse/cdt/autotools/core/AutotoolsNewProjectNature.java: Fix old nature id to contain the .core specifier. 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 f7bbd236872..915011efe15 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 @@ -301,7 +301,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { } private Status regenerateMakefiles(IConfiguration icfg, boolean reconfigure) throws CoreException { - Status status; + MultiStatus status; int rc = IStatus.OK; String errMsg = new String(); boolean needFullConfigure = false; @@ -614,7 +614,14 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { } finally { // getGenerationProblems().clear(); status = new MultiStatus(AutotoolsPlugin - .getUniqueIdentifier(), rc, errMsg, null); + .getUniqueIdentifier(), rc, errMsg, null); + if (rc != IStatus.OK) + status.add(new Status ( + rc, + AutotoolsPlugin.getUniqueIdentifier(), + 0, + errMsg, + null)); } return status; } @@ -1032,21 +1039,24 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { } configTargets[0] = getPathString(commandPath); - // Fix for bug #343731 + // Fix for bug #343879 if (Platform.getOS().equals(Platform.OS_WIN32) - || Platform.getOS().equals(Platform.OS_MACOSX)) { + || Platform.getOS().equals(Platform.OS_MACOSX)) removePWD = true; - // Neither Mac or Windows support calling scripts directly. - String command = null; - for (String arg : configTargets) { - // TODO check for spaces in args - if (command == null) - command = arg; - else - command += " " + arg; - } - configTargets = new String[] { "-c", command }; + + // Fix for bug #343731 and bug #371277 + // Always use sh -c for executing autotool scripts which should + // work on all Linux POSIX compliant shells including bash, dash, as + // well as Windows and Mac OSX. + String command = null; + for (String arg : configTargets) { + // TODO check for spaces in args + if (command == null) + command = arg; + else + command += " " + arg; } + configTargets = new String[] { "-c", command }; for (int i = 0; i < configTargets.length; ++i) { // try to resolve the build macros in any argument @@ -1060,7 +1070,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator { cfg); // strip any env-var settings from options // fix for bug #356278 - if (resolved.charAt(0) != '-') + if (resolved.length() > 0 && resolved.charAt(0) != '-') resolved = stripEnvVarsFromOption(resolved, additionalEnvs); configTargets[i] = resolved; } catch (BuildMacroException e) {