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

Glitches due to "Execute Windows batch command" being stored with UNIX line endings

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • batch-task-plugin
    • None

      I get "The system cannot find the batch label specified" error even though label exists.
      The problems doesn't reproduce when I copy "Execute Windows batch command" text into .bat file and run it.
      I've discovered that line endings are NOT CRLF in the batch script stored in config.xml - but they should be.

      See http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-ex for explanation.

          [JENKINS-9528] Glitches due to "Execute Windows batch command" being stored with UNIX line endings

          bogdaniosif added a comment - - edited

          A better solution would be to modify the Win batch step so that it always generates .bat files with CRLF EOLs, regardless of what EOLs are used when the .bat content is stored in config.xml. See more details in issue 7478, which is duplicated by this one.

          Jenkins already has enough problems when parsing XML files containing newlines in element text and it would be pretty complicated to handle config.xml files containing a mix of LF and CRLF EOLs, especially for those who already have automation steps in place to automatically get/modify/generate new jobs.

          bogdaniosif added a comment - - edited A better solution would be to modify the Win batch step so that it always generates .bat files with CRLF EOLs, regardless of what EOLs are used when the .bat content is stored in config.xml. See more details in issue 7478, which is duplicated by this one. Jenkins already has enough problems when parsing XML files containing newlines in element text and it would be pretty complicated to handle config.xml files containing a mix of LF and CRLF EOLs, especially for those who already have automation steps in place to automatically get/modify/generate new jobs.

          Ivan Mounitsyn added a comment - - edited

          Same issue here. When Jenkins slave is processing a .bat file generated as part of a build, it processes first several lines, then quietly skips a few dozen lines then continues on till the end. No errors or warnings. Looks like a major bug to me.

          The same .bat file copied over (while build is still running), then after \n to \r\n replacement runs good.

          Ivan Mounitsyn added a comment - - edited Same issue here. When Jenkins slave is processing a .bat file generated as part of a build, it processes first several lines, then quietly skips a few dozen lines then continues on till the end. No errors or warnings . Looks like a major bug to me. The same .bat file copied over (while build is still running), then after \n to \r\n replacement runs good.

          Daniel Beck added a comment -

          Duplicate of JENKINS-7478

          Daniel Beck added a comment - Duplicate of JENKINS-7478

            kohsuke Kohsuke Kawaguchi
            pancake pancake
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: