Skip to content

[JENKINS-33239] Environment variable resolves variables recursively #21801

@jenkins-infra-bot

Description

@jenkins-infra-bot

The function hudson.Util.replaceMacro(String, ...) resolves recursively properties, such as:
PATH=path1:$PATH
into
PATH=path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1: etc.

I encountered it when setting variables for slave and running multijob with envinject - the variables were calculated and passed to the child jobs and resulted in running out of memory. More precisely with this variable:
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

I would expect Jenkins to resolve the R-value and push it in L-value, not to resolve it over and over again.

Note: I didn't set the variable like this, I suppose it was meant to take $LD_LIBRARY_PATH from Linux server settings and append $ORACLE_HOME/lib

Note2: Version 1.580.3 ran with those variables fine.


Originally reported by trainmaster, imported from: Environment variable resolves variables recursively
  • status: Open
  • priority: Major
  • component(s): core
  • label(s): environment-variables, newbie-friendly, regression
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 2025-11-24
Raw content of original issue

The function hudson.Util.replaceMacro(String, ...) resolves recursively properties, such as: PATH=path1:$PATH into PATH=path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1:path1: etc.

I encountered it when setting variables for slave and running multijob with envinject - the variables were calculated and passed to the child jobs and resulted in running out of memory. More precisely with this variable: LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

I would expect Jenkins to resolve the R-value and push it in L-value, not to resolve it over and over again.

Note: I didn't set the variable like this, I suppose it was meant to take $LD_LIBRARY_PATH from Linux server settings and append $ORACLE_HOME/lib

Note2: Version 1.580.3 ran with those variables fine.

  • environment: Jenkins 1.642.1, Jenkins 2.60.1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions