You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2020/11/17 12:29:00 UTC

[Bug 64927] New: Arguments passed using "value" attributes are split by space

https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

            Bug ID: 64927
           Summary: Arguments passed using "value" attributes are split by
                    space
           Product: Ant
           Version: 1.10.9
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: cosmin_duna@sync.ro
  Target Milestone: ---

Created attachment 37568
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37568&action=edit
sample

I attached a zip file that contains a sample to reproduce this problem.

When I execute the following command:
"ant.bat -f "D:\test\build.xml" "-Dscript.location=D:\test\Directory With White
Spaces\test.bat" "-Dproject.file=D:\test\project file.xml" -verbose" 
I receive this error:
     [exec] Current OS is Windows 10
     [exec] Executing 'cmd' with arguments:
     [exec] '/c'
     [exec] 'D:\test\Directory With White Spaces\test.bat'
     [exec] '--project'
     [exec] 'D:\test\project file.xml'
     [exec]
     [exec] The ' characters around the executable and arguments are
     [exec] not part of the command.
     [exec] 'D:\test\Directory' is not recognized as an internal or external
command,
     [exec] operable program or batch file.

If I remove white-spaces from one argument all is ok. Link in this command:
"ant.bat -f "D:\test\build.xml" "-Dscript.location=D:\test\Directory With White
Spaces\test.bat" "-Dproject.file=D:\test\project_file.xml" -verbose"

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64927] Arguments passed using "value" attributes are split by space

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

--- Comment #2 from Cosmin Duna <co...@sync.ro> ---
It can be a problem only on Windows OS

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64927] Arguments passed using "value" attributes are split by space

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

--- Comment #3 from Cosmin Duna <co...@sync.ro> ---
I tried to use the "line" attribute with "&quot;" entities and I modified my
build file in this: 

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="" name="Buid DITA Project" default="dist">
    <target name="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
        <exec executable="cmd" failonerror="yes">
            <arg line="/C &quot;${script.location}&quot; --project
&quot;${project.file}&quot;"/>       
        </exec>
    </target>
</project>

And I had the same problem. If only one variable has white-space in path
everything works fine. When both variables have white-space this error appears:

C:\Users\cosmin_duna\Downloads\apache-ant-1.10.9\bin>ant.bat -f
"D:\test\build.xml" "-Dscript.location=D:\test\Directory With White
Spaces\test.bat" "-Dproject.file=D:\test\project file.xml"
Buildfile: D:\test\build.xml

dist:
     [exec] 'D:\test\Directory' is not recognized as an internal or external
command,
     [exec] operable program or batch file.

BUILD FAILED
D:\test\build.xml:4: exec returned: 1

Total time: 0 seconds

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64927] Arguments passed using "value" attributes are split by space

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

--- Comment #4 from Cosmin Duna <co...@sync.ro> ---
It seems that it's a problem from my build file:
https://stackoverflow.com/questions/6376113/how-do-i-use-spaces-in-the-command-prompt

It's working if I modify the file like this:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="" name="Buid DITA Project" default="dist">
    <target name="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">    
        <exec executable="cmd" failonerror="yes">
            <arg line="/c &quot; &quot;${script.location}&quot; --project
&quot;${project.file}&quot;  &quot;"/>
        </exec>
    </target>
</project>

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64927] Arguments passed using "value" attributes are split by space

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Jaikiran Pai <ja...@apache.org> ---
I haven't been able to reproduce this on a *nix setup with a similar project:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="" name="64927" default="dist">
    <target name="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
        <echo message="projectFile: ${project.file}" />
        <echo message="script.location: ${script.location}" />

        <exec executable="sh" failonerror="yes">
            <arg value="${script.location}"/>   

            <!-- Set the project xml file -->
            <arg value="--project"/>
            <arg value="${project.file}"/>
        </exec>
    </target>
</project>


The command:

ant "-Dscript.location=./Directory With White Spaces/test.sh"
"-Dproject.file=./project file.xml" 

works fine:

 [echo] projectFile: ./project file.xml
     [echo] script.location: ./Directory With White Spaces/test.sh
     [exec] Hello world

(contents of test.sh is just a simple echo "Hello world" which gets printed in
that output).

I don't have access to any Windows setup to give this a try there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 64927] Arguments passed using "value" attributes are split by space

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64927

--- Comment #5 from Gintas Grigelionis <gi...@apache.org> ---
Seems to be a problem with cmd-specific quoting; in other words, something that
might be highlighted in the documentation of exec task?

-- 
You are receiving this mail because:
You are the assignee for the bug.