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

bad path environment set by Jenkins

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Duplicate
    • core
    • None
    • Windows

    Description

      Reproduction:

      Create a freestyle job. As only build step, have a Windows batch containing "set". Run and inspect the console output, look for the PATH environment variable.

      Result:

      Jenkins wrongly uses quotes when adding the current JRE path, e.g. in my case the PATH is shown like this
      Path=C:\Program Files\Java\jre6\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;"C:\Program Files\Java\jre6\bin"

      Every command which tries to modify the path during a Jenkins job will fail because of those wrong quotes, e.g. you can no longer run batch commands like

      setx PATH "%PATH%;c:\some\new\path" /m

      because the quotes are incorrectly nested.

      Running "set" outside Jenkins produces the same path without the quoted JRE path.

      Jenkins version 1.527

      Attachments

        Issue Links

          Activity

            danielbeck Daniel Beck added a comment -

            How did you configure JDKs in Jenkins? This looks like you specified the path there. Did you put that value in quotes?

            Are you able e.g. on a temporary test instance to reproduce the problem with a recent Jenkins version?

            danielbeck Daniel Beck added a comment - How did you configure JDKs in Jenkins? This looks like you specified the path there. Did you put that value in quotes? Are you able e.g. on a temporary test instance to reproduce the problem with a recent Jenkins version?
            biriuck ilie daniel added a comment - - edited

            1577 jenkins version
            Running a batch file from jenknins with content:
            @echo on
            set a
            set b
            set c
            set d
            set e
            set f
            set g
            set h
            set i
            set j
            set k
            set l
            set m
            set n
            set o
            set p
            set r
            set s
            set t
            set q
            set u
            set v
            set w
            set x
            set y
            set z

            set>outputEnvironment.txt

            will lead to the same problem with Path variable

            biriuck ilie daniel added a comment - - edited 1577 jenkins version Running a batch file from jenknins with content: @echo on set a set b set c set d set e set f set g set h set i set j set k set l set m set n set o set p set r set s set t set q set u set v set w set x set y set z set>outputEnvironment.txt will lead to the same problem with Path variable
            biriuck ilie daniel added a comment - - edited
            biriuck ilie daniel added a comment - - edited I think that is the same issue : https://issues.jenkins-ci.org/browse/JENKINS-11992
            oleg_nenashev Oleg Nenashev added a comment -

            Yes, it's a duplicate.
            BTW, the name of the old issue is not good

            oleg_nenashev Oleg Nenashev added a comment - Yes, it's a duplicate. BTW, the name of the old issue is not good

            People

              Unassigned Unassigned
              bananeweizen Michael Keppler
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: