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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Won't Fix
    • core
    • None
    • Ubuntu 12.04 x86

    Description

      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.

      Attachments

        Issue Links

          Activity

            rhetzler Rob Hetzler added a comment -

            Re-raising. this is a problem in jenkins 2.0 as well

            rhetzler Rob Hetzler added a comment - Re-raising. this is a problem in jenkins 2.0 as well
            johey Johan Smolinski added a comment - - edited

            I believe I am affected by this issue. My problem is that the $http_proxy is removed, and only $HTTP_PROXY is kept. I am using a pipeline with this stage:

            stage('curly') {
                sh 'http_proxy=$HTTP_PROXY curl http://example.com/'
            }
            

            This works fine, as I have applied my workaround http_proxy=$HTTP_PROXY, but otherwise the $http_proxy is removed. Using jenkins 2.46.1 on GNU/Linux, openjdk 1.8.

            johey Johan Smolinski added a comment - - edited I believe I am affected by this issue. My problem is that the $http_proxy is removed, and only $HTTP_PROXY is kept. I am using a pipeline with this stage: stage( 'curly' ) { sh 'http_proxy=$HTTP_PROXY curl http: //example.com/' } This works fine, as I have applied my workaround http_proxy=$HTTP_PROXY, but otherwise the $http_proxy is removed. Using jenkins 2.46.1 on GNU/Linux, openjdk 1.8.
            godfath3r Panagiotis Galatsanos added a comment - - edited

            and a simple test reproducing this issue: https://gist.github.com/godfath3r/d16e1a0e5beebd912344d55fb9ae9709

            godfath3r Panagiotis Galatsanos added a comment - - edited and a simple test reproducing this issue: https://gist.github.com/godfath3r/d16e1a0e5beebd912344d55fb9ae9709
            teilo James Nord added a comment - This is by design as per https://javadoc.jenkins.io/hudson/EnvVars.html#:~:text=So%20for%20a%20consistent%20cross%20platform%20behavior%2C%20it%20creates%20the%20least%20confusion%20to%20make%20the%20table%20case%20insensitive%20but%20case%20preserving
            teilo James Nord added a comment -

            This is not a bug but the design choice from the early 21st century, and changing it would be problematic as it would be impactful.

            Whilst that is not to say that there could not be a future improvement to handle environment variables in a different way, it needs to be done carefully and would probably necessitate a new API. So closing this bug - and any future improvement would need to be tackled under a different ticket.

            teilo James Nord added a comment - This is not a bug but the design choice from the early 21st century, and changing it would be problematic as it would be impactful. Whilst that is not to say that there could not be a future improvement to handle environment variables in a different way, it needs to be done carefully and would probably necessitate a new API. So closing this bug - and any future improvement would need to be tackled under a different ticket.

            People

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

              Dates

                Created:
                Updated:
                Resolved: