Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-16255

Jenkins doesn't handle system wide environment variables which exist in different cases

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • core
    • None
    • Ubuntu 12.04 x86

      If system-wide environment variables have been set via /etc/environment those are not accessible if they exist in lower-case and capital case letters. Jenkins combines both variables into a single one, and updates the first detected variable with the value of the second one. Here some examples:

      Example 1:

      /etc/environment
      http_proxy=http://proxy.dmz.example.org:8080
      HTTP_PROXY=http://proxy.dmz.example.org:8080

      -> Jenkins:
      HTTP_PROXY=http://proxy.dmz.example.org:8080

      Example 2:

      Shell:
      export test=1
      export TEST=2

      -> Jenkins
      TEST=1

      Jenkins should not modify set environment variables because it will cause problems with tools which rely on the right capitalization. One example is mercurial which needs the lower case version of the proxy configuration. It will no longer work when both variables are set.

          [JENKINS-16255] Jenkins doesn't handle system wide environment variables which exist in different cases

          Henrik Skupin created issue -
          Henrik Skupin made changes -
          Component/s New: core [ 15593 ]
          Component/s Original: environment-script [ 16821 ]
          Henrik Skupin made changes -
          Assignee Original: Jørgen Tjernø [ jorgenpt ]

          Henrik Skupin added a comment -

          Oh and one more example:

          shell:

          export test=1

          -> Jenkins
          test=1

          As you can see we keep the lower letters if no variable with the same name and capital letters exist.

          Henrik Skupin added a comment - Oh and one more example: shell: export test=1 -> Jenkins test=1 As you can see we keep the lower letters if no variable with the same name and capital letters exist.

          ikedam added a comment -

          This may be caused by here (I have not verified it yet): https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/EnvVars.java#L76

              public EnvVars() {
                  super(CaseInsensitiveComparator.INSTANCE);
              }
          

          This code is from this revision: https://github.com/jenkinsci/jenkins/commit/78b96c34ed168a27ae79b63bd2575b91908c7d11, and is fix for JENKINS-968 .

          What I will do is:

          • Check whether the code of EnvVars is really the cause of this problem.
          • 78b96c3 was really a proper way to fix JENKINS-968.

          ikedam added a comment - This may be caused by here (I have not verified it yet): https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/EnvVars.java#L76 public EnvVars() { super (CaseInsensitiveComparator.INSTANCE); } This code is from this revision: https://github.com/jenkinsci/jenkins/commit/78b96c34ed168a27ae79b63bd2575b91908c7d11 , and is fix for JENKINS-968 . What I will do is: Check whether the code of EnvVars is really the cause of this problem. 78b96c3 was really a proper way to fix JENKINS-968 .
          ikedam made changes -
          Link New: This issue is related to JENKINS-968 [ JENKINS-968 ]

          ikedam added a comment -

          I verified that not using CaseInsensitiveComparator.INSTANCE resolves the problem.

          ikedam added a comment - I verified that not using CaseInsensitiveComparator.INSTANCE resolves the problem.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-19977 [ JENKINS-19977 ]
          Jesse Glick made changes -
          Link Original: This issue is related to JENKINS-19977 [ JENKINS-19977 ]

          ikedam added a comment -

          Sent a pull request: https://github.com/jenkinsci/jenkins/pull/985
          But this conflicts with JENKINS-19926, b95f2694529d22523701e8fe20f4f20b2f4d9fc4 .
          I should know what that commit does.

          ikedam added a comment - Sent a pull request: https://github.com/jenkinsci/jenkins/pull/985 But this conflicts with JENKINS-19926 , b95f2694529d22523701e8fe20f4f20b2f4d9fc4 . I should know what that commit does.

            Unassigned Unassigned
            whimboo Henrik Skupin
            Votes:
            13 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: