1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

[302724] problems with environment variable substitution

This commit is contained in:
David McKnight 2010-02-12 15:57:40 +00:00
parent 0bb3b9e3f2
commit b5d463fd80
2 changed files with 15 additions and 6 deletions

View file

@ -26,6 +26,7 @@
* David McKnight (IBM) [287305] [dstore] Need to set proper uid for commands when using SecuredThread and single server for multiple clients[
* Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read
* David McKnight (IBM) [302174] [dstore] shell init command can potentially get called too late
* David McKnight (IBM) [302724] problems with environment variable substitution
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -753,9 +754,9 @@ public class CommandMinerThread extends MinerThread
DataElement projectEnv = null;
if (projectEnvReference != null && (projectEnvReference.size() > 0))
projectEnv = (DataElement) projectEnvReference.get(0);
String[] theEnv = mergeEnvironments(systemEnv, projectEnv);
return theEnv;
}
@ -791,6 +792,7 @@ public class CommandMinerThread extends MinerThread
String theKey = getKey(theVariable);
String theValue = getValue(theVariable);
theValue = calculateValue(theValue, varTable);
varTable.put(theKey, theValue);
}
@ -872,12 +874,17 @@ public class CommandMinerThread extends MinerThread
{
if (Character.isJavaIdentifierStart(c))
{
while (nextIndex + 1 < theValue.length() && (Character.isJavaIdentifierPart(c)))
{
nextIndex++;
c = theValue.charAt(nextIndex);
c = theValue.charAt(nextIndex);
if (nextIndex + 1 == theValue.length()){
nextIndex++;
}
}
String v = theValue.substring(index + 1, nextIndex);
String replacementValue = findValue(v, theTable, true);
theValue.replace(index, nextIndex, replacementValue);
@ -885,6 +892,7 @@ public class CommandMinerThread extends MinerThread
}
}
}
} //If the current char is a %, then simply look for a matching %
else if (c == '%' && _isWindows)
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2009 IBM Corporation and others.
* Copyright (c) 2002, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -22,6 +22,7 @@
* David McKnight (IBM) - [230285] [shells] Remote shells should be restored on quit and re-start of RSE
* David McKnight (IBM) - [252708] Saving Profile Job happens when not changing Property Values on Connections
* David McKnight (IBM) - [272882] [api] Handle exceptions in IService.initService()
* David McKnight (IBM) [302724] problems with environment variable substitution
*******************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems;
@ -302,7 +303,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
{
for (int i = userVars.length - 1; i >= 0; i--)
{
String userVar = userVars[i];
String userVar = userVars[i];
String varName = null;
int assignIndex = userVar.indexOf('=');
if (assignIndex > 0)
@ -310,7 +311,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd
varName = userVar.substring(0, assignIndex + 1);
if (isUniqueVariable(combinedVars, varName))
{
combinedVars.add(userVar);
combinedVars.add(0,userVar);
}
}
}