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

'chcp' is not recognized as an internal or external command, operable program or batch file.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: msbuild-plugin
    • Labels:
    • Environment:
      Win7 in Dutch, Jenkins v2.46, MSBuild Plugin v1.27
    • Similar Issues:

      Description

      After upgrading from MSBuild Plugin v1.26 to v1.27, all builds using MSBuild plugin failed with:

      'chcp' is not recognized as an internal or external command, operable program or batch file.

      This seems to be related to case: JENKINS-24132.

      As a work-around, i (manually) reverted to MSBuild Plugin v1.26.

      Running chcp on the same machine works, running chcp via the Jenkins script console yields the same error.
      Running chcp.com via the Jenkins script console works.

      Can we please change chcp to chcp.com?

        Attachments

          Activity

          kompjoefriek Roel van Nuland created issue -
          kompjoefriek Roel van Nuland made changes -
          Field Original Value New Value
          Description After upgrading from MSBuild Plugin v1.26 to v1.27, all builds using MSBuild plugin failed with:

          {code:none}'chcp' is not recognized as an internal or external command, operable program or batch file.{code}

          This seems to be released with case: JENKINS-24132.

          As a work-around, i (manually) reverted to MSBuild Plugin v1.26.

          Running {{chcp}} on the same machine works, running {{chcp}} via the Jenkins script console yields the same error.
          Running {{chcp.com}} via the Jenkins script console works.

          Can we please change {{chcp}} to {{chcp.com}}?
          After upgrading from MSBuild Plugin v1.26 to v1.27, all builds using MSBuild plugin failed with:

          {code:none}'chcp' is not recognized as an internal or external command, operable program or batch file.{code}

          This seems to be related to case: JENKINS-24132.

          As a work-around, i (manually) reverted to MSBuild Plugin v1.26.

          Running {{chcp}} on the same machine works, running {{chcp}} via the Jenkins script console yields the same error.
          Running {{chcp.com}} via the Jenkins script console works.

          Can we please change {{chcp}} to {{chcp.com}}?
          Hide
          marshall777 Lionel Cabasson added a comment -

          Hello,

          It is pretty strange indeed. Could you please provide the following informations :

          • Is Jenkins running on a x64 system ?
          • Could you run "where chcp" and "where chcp.com" out of Jenkins and inside of Jenkins (using Jenkins script console) ?
          • Could you run "echo %PATH%" inside and outside Jenkins ?

          Thanks
          Regards
          Lionel

          Show
          marshall777 Lionel Cabasson added a comment - Hello, It is pretty strange indeed. Could you please provide the following informations : Is Jenkins running on a x64 system ? Could you run "where chcp" and "where chcp.com" out of Jenkins and inside of Jenkins (using Jenkins script console) ? Could you run "echo %PATH%" inside and outside Jenkins ? Thanks Regards Lionel
          Hide
          kompjoefriek Roel van Nuland added a comment -

          Hi Lionel,

          Yes, the slave runs on a x64 machine (as does the server).
          It is Windows 7 64bit, running 64bit java:

          java version "1.8.0_121"
          Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
          Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
          

          The slave runs jenkins as a service, and jenkins-slave.exe also seems to be 64bit.

          On the slave (directly from the prompt):

          • "where chcp" -> "C:\Windows\System32\chcp.com"
          • "where chcp.com" -> "C:\Windows\System32\chcp.com"
          • "echo %path%" -> "C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\"

          On the slave via script console:

          • "where chcp" -> "C:\Windows\System32\chcp.com"
          • "where chcp.com" -> "C:\Windows\System32\chcp.com"
          • "println System.getenv("PATH")" -> "C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\"

          I could not get "echo %path%" to work via script console.
          Please note that i removed some personal info from the path, but both where identical.

          I did some further testing, and "chcp" works after i copied "C:\Windows\System32\chcp.com" to "C:\Windows\System32\chcp.exe"

          Regards, Roel.

          Show
          kompjoefriek Roel van Nuland added a comment - Hi Lionel, Yes, the slave runs on a x64 machine (as does the server). It is Windows 7 64bit, running 64bit java: java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) The slave runs jenkins as a service, and jenkins-slave.exe also seems to be 64bit. On the slave (directly from the prompt): "where chcp" -> "C:\Windows\System32\chcp.com" "where chcp.com" -> "C:\Windows\System32\chcp.com" "echo %path%" -> "C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\" On the slave via script console: "where chcp" -> "C:\Windows\System32\chcp.com" "where chcp.com" -> "C:\Windows\System32\chcp.com" "println System.getenv("PATH")" -> "C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\" I could not get "echo %path%" to work via script console. Please note that i removed some personal info from the path, but both where identical. I did some further testing, and "chcp" works after i copied "C:\Windows\System32\chcp.com" to "C:\Windows\System32\chcp. exe " Regards, Roel.
          Hide
          kompjoefriek Roel van Nuland added a comment -

          Hi,
           
          Some more info:
          even after copying chcp.com to chcp.exe, the v1.27 plugin still produces the same error.

          I'm not running the Jenkins slave service as the default user (Local system) but as a dedicated User which is part of the Users group.
          (I did not yet fiddle with the rights of that user, just a standard new local Windows user).

          Might that have something to do with it?

          Regards, Roel.

          Show
          kompjoefriek Roel van Nuland added a comment - Hi,   Some more info: even after copying chcp.com to chcp.exe , the v1.27 plugin still produces the same error. I'm not running the Jenkins slave service as the default user (Local system) but as a dedicated User which is part of the Users group. (I did not yet fiddle with the rights of that user, just a standard new local Windows user). Might that have something to do with it? Regards, Roel.
          Hide
          marshall777 Lionel Cabasson added a comment -

          Hello,

          Maybe this user does not have access right to chcp or the user PATH environment variable does not contain its parent forlder.

          Could you try running Jenkins with the Local system user for the sake of testing ?

          I wanted to wait a little bit to see if there was any other user who encountered the same issue but it seems you're the only one so it's probably an environment specific problem. By the way, I will think about adding an option not to run chcp so that one can disable it if any problem arise.

          Regards
          Lionel

          Show
          marshall777 Lionel Cabasson added a comment - Hello, Maybe this user does not have access right to chcp or the user PATH environment variable does not contain its parent forlder. Could you try running Jenkins with the Local system user for the sake of testing ? I wanted to wait a little bit to see if there was any other user who encountered the same issue but it seems you're the only one so it's probably an environment specific problem. By the way, I will think about adding an option not to run chcp so that one can disable it if any problem arise. Regards Lionel
          Hide
          kompjoefriek Roel van Nuland added a comment -

          Hi Lionel,

          I've changed the service to run as Local Service now, and it behaves exactly like it did when it ran as a separate user.
          I also tried with Local System by reinstalling the service, but this also behaves exactly like it did when it ran as a separate user.

          Adding the option to not run chcp would be greatly appreciated.

          Regards, Roel.

          Show
          kompjoefriek Roel van Nuland added a comment - Hi Lionel, I've changed the service to run as Local Service now, and it behaves exactly like it did when it ran as a separate user. I also tried with Local System by reinstalling the service, but this also behaves exactly like it did when it ran as a separate user. Adding the option to not run chcp would be greatly appreciated. Regards, Roel.
          Hide
          scb147 Shawn Baker added a comment -

          I'm having this exact problem.  Jenkins 2.46.1 LTS, MSBuild V1.27 on Windows Server 2012 R2 64-bit.  When I downgrade the MSBuild back to V1.26, the problem goes away.

          Show
          scb147 Shawn Baker added a comment - I'm having this exact problem.  Jenkins 2.46.1 LTS, MSBuild V1.27 on Windows Server 2012 R2 64-bit.  When I downgrade the MSBuild back to V1.26, the problem goes away.
          Hide
          marshall777 Lionel Cabasson added a comment -

          Hello Shawn,

          Thanks for your feedback, I will try to take some time to do a new release with the following features :

          • an error running chcp should be ignored and not prevent msbuild from running
          • the plugin should provide an option to disable the chcp command

          Regards
          Lionel

          Show
          marshall777 Lionel Cabasson added a comment - Hello Shawn, Thanks for your feedback, I will try to take some time to do a new release with the following features : an error running chcp should be ignored and not prevent msbuild from running the plugin should provide an option to disable the chcp command Regards Lionel
          Hide
          ajitsurana Ajit Surana added a comment -

          Is this problem resolved?
          I can see exact same problem given by Build a Visual Studio project or solution using MSBuild Jenkins plugin in the slave job.

          Command:

          [Klocwork_CSharp_Project_Builder] $ cmd.exe /C " chcp 1252 && "C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe" /p:Configuration=Release %WORKSPACE%\KWCSharpProjectBuilder.sln " && exit %%ERRORLEVEL%%
          

          Error:

          'chcp' is not recognized as an internal or external command,
          
          Show
          ajitsurana Ajit Surana added a comment - Is this problem resolved? I can see exact same problem given by Build a Visual Studio project or solution using MSBuild Jenkins plugin in the slave job. Command: [Klocwork_CSharp_Project_Builder] $ cmd.exe /C " chcp 1252 && "C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe" /p:Configuration=Release %WORKSPACE%\KWCSharpProjectBuilder.sln " && exit %%ERRORLEVEL%% Error: 'chcp' is not recognized as an internal or external command,
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Marshall
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          src/main/resources/hudson/plugins/msbuild/MsBuildBuilder/config.jelly
          http://jenkins-ci.org/commit/msbuild-plugin/78cf15892d8411edae8aded2ec13e9b12015c740
          Log:
          JENKINS-42284 Add an option to prevent chcp from being executed

          Since some users encountered an error when the plugin was running chcp
          command, this commit add a checkbox on the msbuild step allowing to
          prevent the plugin from running it.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marshall Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java src/main/resources/hudson/plugins/msbuild/MsBuildBuilder/config.jelly http://jenkins-ci.org/commit/msbuild-plugin/78cf15892d8411edae8aded2ec13e9b12015c740 Log: JENKINS-42284 Add an option to prevent chcp from being executed Since some users encountered an error when the plugin was running chcp command, this commit add a checkbox on the msbuild step allowing to prevent the plugin from running it.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Marshall
          Path:
          src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
          http://jenkins-ci.org/commit/msbuild-plugin/c1b2074190a938099e04b2cae88febee88bf32a8
          Log:
          JENKINS-42284 Improvement of chcp error handling

          The chcp command no more prevents msbuild from running in case of error.
          If the command fails, the plugin will still run msbuild so the build can
          continue.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marshall Path: src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java http://jenkins-ci.org/commit/msbuild-plugin/c1b2074190a938099e04b2cae88febee88bf32a8 Log: JENKINS-42284 Improvement of chcp error handling The chcp command no more prevents msbuild from running in case of error. If the command fails, the plugin will still run msbuild so the build can continue.
          Hide
          marshall777 Lionel Cabasson added a comment -

          Hello,

          Release 1.28 should solve the issue :

          • chcp errors no longer fail the build. If an error occured, it is ignored and msbuild is run anyway
          • a checkbox has been added on the build step configuration allowing you to prevent the plugin from running chcp (although it should not be necessary since chcp should not fail the build anymore)

          Regards
          Lionel

          Show
          marshall777 Lionel Cabasson added a comment - Hello, Release 1.28 should solve the issue : chcp errors no longer fail the build. If an error occured, it is ignored and msbuild is run anyway a checkbox has been added on the build step configuration allowing you to prevent the plugin from running chcp (although it should not be necessary since chcp should not fail the build anymore) Regards Lionel
          marshall777 Lionel Cabasson made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              marshall777 Lionel Cabasson
              Reporter:
              kompjoefriek Roel van Nuland
            • Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: