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

Running shell script broken - was: Net build fails due to douple PATH enviroment Variable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • batch-task-plugin
    • None
    • Platform: PC, OS: Windows XP

      If you are running a batch task for some net build and the build uses dynamic
      code compilation (like ASP.Net, xsl transformation (MbUnit reporting)) then you
      can get the following error stack (snippet):

      Item has already been added. Key in dictionary: 'path' Key being added: 'path'
      [System.ArgumentException: Item has already been added. Key in dictionary:
      'path' Key being added: 'path'
      at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
      at System.Collections.Hashtable.Add(Object key, Object value)
      at System.Collections.Specialized.StringDictionary.Add(String key, String value)
      at
      System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle
      userToken, String cmd, String currentDir, TempFileCollection tempFiles, String&
      outputName, String& errorName, String trueCmdLine)
      at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle
      userToken, String cmd, String currentDir, TempFileCollection tempFiles, String&
      outputName, String& errorName, String trueCmdLine)
      at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options,
      String compilerDirectory, String compilerExe, String arguments, String&
      outputFile, Int32& nativeReturnValue, String trueArgs)
      at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters
      options, String[] fileNames)
      at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters
      options, String[] sources)
      at
      Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters
      options, String[] sources)
      at
      System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters
      options, String[] sources)
      ...

      This is caused (in my case) by a double entry for the path environment variable.
      I printed out the Net System.Environment while running under hudson (snippet):

      ...
      Path:C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\DrDOC\SYSTEM;C:\Programme\Microsoft
      Visual Studio\Common\VSS\win32;C:\Programme\Microsoft SQL
      Server\80\Tools\BINN;C:\Programme\Support
      Tools\;C:\Programme\CVSNT\;C:\Programme\apache-ant\bin\;c:\Programme\svn\bin
      SVN_REVISION:104
      USERDNSDOMAIN:xxx.de
      BUILD_ID:2007-10-31_10-05-38
      PATH:C:\Programme\Java\jdk1.5.0_05\bin
      ...

      For the base problem please see the following forum rss:

      http://forums.microsoft.com/msdn/rss.aspx?postid=231948&forumid=18&siteid=1

          [JENKINS-968] Running shell script broken - was: Net build fails due to douple PATH enviroment Variable

          mcmatt created issue -

          Fixed in 1.152.

          On Windows, environment variables are case insensitive but case preserving, just
          like its file system. So when Hudson builds up the environment variable list for
          a new child process, it needs to take this into account.

          Kohsuke Kawaguchi added a comment - Fixed in 1.152. On Windows, environment variables are case insensitive but case preserving, just like its file system. So when Hudson builds up the environment variable list for a new child process, it needs to take this into account.
          Kohsuke Kawaguchi made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          hostlows added a comment -

          Almost works, but build 1.152 breaks free-style-project builds:

          Shell script PATH env is wrong, Windows Batch works:

          How to test it:
          have both scripts set-up, both calling command 'set' to print the environment
          variables.
          Output:

          • shell:
            ...
            PATH=/d/lib/jdk1.6.0/bin
            ...
          • windows batch:
            Path=C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin\bin;C:\cygwin\usr\local\bin;...
            PATH=d:\lib\jdk1.6.0\bin
            ...

          Please fix it.

          P.S. hudson works great, I love it!

          hostlows added a comment - Almost works, but build 1.152 breaks free-style-project builds: Shell script PATH env is wrong, Windows Batch works: How to test it: have both scripts set-up, both calling command 'set' to print the environment variables. Output: shell: ... PATH=/d/lib/jdk1.6.0/bin ... windows batch: Path=C:\WINDOWS\system32;C:\WINDOWS;C:\cygwin\bin;C:\cygwin\usr\local\bin;... PATH=d:\lib\jdk1.6.0\bin ... Please fix it. P.S. hudson works great, I love it!
          hostlows made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          Wrt "Shell script PATH env is wrong", I couldn't reproduce the behavior. What
          shell are you using?

          The rest of the issue I fixed in 1.154.

          Kohsuke Kawaguchi added a comment - Wrt "Shell script PATH env is wrong", I couldn't reproduce the behavior. What shell are you using? The rest of the issue I fixed in 1.154.
          Kohsuke Kawaguchi made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Reopened [ 4 ] New: Resolved [ 5 ]

          hostlows added a comment -

          Hi,
          I'm just using Cygwin's bash
          It worked quite well until 1.15x, so please verify what has changed in that area.
          Thanks.

          hostlows added a comment - Hi, I'm just using Cygwin's bash It worked quite well until 1.15x, so please verify what has changed in that area. Thanks.

          hostlows added a comment -

          works since 1.158

          hostlows added a comment - works since 1.158
          hostlows made changes -
          Status Original: Resolved [ 5 ] New: Verified [ 10000 ]

            kohsuke Kohsuke Kawaguchi
            mcmatt mcmatt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: