[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Environment variables and prepend operations

A workaround for this has been to remove our toolchain's
projectEnvironmentSupplier and only leave its
configurationEnvironmentSupplier. 

This circumvents the problem by avoiding the case where the same
environment variable is prepended with itself. Still, the
EnvVarOperationProcessor will override the original variable operation
if that should happen.

/Mario

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Mario Pierro
Sent: den 29 september 2009 21:16
To: CDT General developers list.
Subject: [cdt-dev] Environment variables and prepend operations

Hello,

Our MBS toolchain contributes IBuildVariable implementations in order to
change the PATH environment variable used while building. The
implementation specifies an ENVVAR_PREPEND operation so that the
contributed path is added at the beginning of the existing system path.

I have noticed that in some circumstances the path provided by our
variable erroneously replaces the system path. This seems to be
connected with the plugins loading order.

The org.eclipse.cdt.utils.envvar.EnvVarOperationProcessor class actually
performs the prepend operation and calculates the new variable. The
result of a prepend operation is an environment variable which is by
default associated to IEnvironmentVariable.ENVVAR_REPLACE, since no
operation is explicitly specified.

>From EnvVarOperationProcessor: line 58 

case IEnvironmentVariable.ENVVAR_PREPEND:{ 
String delimiter = added.getDelimiter(); 
return new EnvironmentVariable(name, 
performPrepend(initial.getValue(),added.getValue(),delimiter), 
//	 IEnvironmentVariable.ENVVAR_PREPEND, 
delimiter); 
}

(The comment on the PREPEND operation is originally there)

What happens is that our PATH build variable can get prepended with
itself, thereby generating a new PATH variable with the same value but
having a REPLACE operation instead of PREPEND. When the prepend result
gets merged with the system path, it erases existing entries.

Is that intended behavior or a bug? Should the prepend operation never
be called on the same variable? I have noticed that the line with the
PREPEND operation in EnvVarOperationProcessor had been commented out as
a bugfix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=175581.

Thank you for your help!

-Mario



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev