Skip to content

[JENKINS-1007] Problem with spaces in path names on XP #187

Closed

Description

@jenkins-infra-bot

This is a little weird. I got an ant build working fine but I had to define a
property for the build to succeed. As soon as I did the log showed that the path
to ant was now proving to be a problem.

In the first case, this is the command that was executed:

cmd.exe /C "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\bin\ant.bat"
-file build.xml && exit %%ERRORLEVEL%%

In the second case this was the command:

cmd.exe /C "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\bin\ant.bat"
-file build.xml "-DTOMCAT_HOME=C:\Tomcat\Tomcat 5.5" && exit %%ERRORLEVEL%%

The only difference is the addition of "-DTOMCAT_HOME=C:\Tomcat\Tomcat 5.5", but
this is the error I get:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Note that without the property definition I don't get this error.


Originally reported by judge2005, imported from: Problem with spaces in path names on XP
  • status: Closed
  • priority: Major
  • component(s): ant-plugin
  • resolution: Fixed
  • resolved: 2007-11-18T21:36:34+00:00
  • votes: 0
  • watchers: 0
  • imported: 20251216-182730
Raw content of original issue

This is a little weird. I got an ant build working fine but I had to define a property for the build to succeed. As soon as I did the log showed that the path to ant was now proving to be a problem.

In the first case, this is the command that was executed:

cmd.exe /C "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\bin\ant.bat" -file build.xml && exit %%ERRORLEVEL%%

In the second case this was the command:

cmd.exe /C "C:\Program Files\eclipse\plugins\org.apache.ant_1.6.5\bin\ant.bat" -file build.xml "-DTOMCAT_HOME=C:\Tomcat\Tomcat 5.5" && exit %%ERRORLEVEL%%

The only difference is the addition of "-DTOMCAT_HOME=C:\Tomcat\Tomcat 5.5", but this is the error I get:

'C:\Program' is not recognized as an internal or external command, operable program or batch file.

Note that without the property definition I don't get this error.

  • environment: Platform: All, OS: Windows XP

Activity

  1. jenkins-infra-bot commented on Nov 18, 2007

    @jenkins-infra-bot
    Author
    kohsuke:
    • Original comment link
    • Raw content of original comment:

      Fixed in 1.157.

      Windows never fail to amaze me when it comes to its handling of processes.

      Quoting from "cmd.exe /?"

      ------------------------ If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (") characters:

      1. If all of the following conditions are met, then quote characters on the command line are preserved:

      • no /S switch
      • exactly two quote characters
      • no special characters between the two quote characters, where special is one of: &<>()@^|
      • there are one or more whitespace characters between the the two quote characters
      • the string between the two quote characters is the name of an executable file.

      2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character. ------------------------

      Also, JDK6 Process implementation for Windows does a lot of rather ad-hoc computation to convert String[] to a single String as required by the CreateProcess API, so Hudson had to work around this problem, too.

      This fix is in 1.157.

    Fixed in 1.157.

    Windows never fail to amaze me when it comes to its handling of processes.

    Quoting from "cmd.exe /?"

    ------------------------
    If /C or /K is specified, then the remainder of the command line after
    the switch is processed as a command line, where the following logic is
    used to process quote (") characters:

    1. If all of the following conditions are met, then quote characters
    on the command line are preserved:

    • no /S switch
    • exactly two quote characters
    • no special characters between the two quote characters,
      where special is one of: &<>()@^|
    • there are one or more whitespace characters between the
      the two quote characters
    • the string between the two quote characters is the name
      of an executable file.

    2. Otherwise, old behavior is to see if the first character is
    a quote character and if so, strip the leading character and
    remove the last quote character on the command line, preserving
    any text after the last quote character.
    ------------------------

    Also, JDK6 Process implementation for Windows does a lot of rather ad-hoc
    computation to convert String[] to a single String as required by the
    CreateProcess API, so Hudson had to work around this problem, too.

    This fix is in 1.157.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions