ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38771] New: - apply task strips needed quote character from command line
Date Thu, 23 Feb 2006 18:36:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38771>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38771

           Summary: apply task strips needed quote character from command
                    line
           Product: Ant
           Version: 1.6.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: bpracht@nc.rr.com


I'm trying to compile a C program with a fix level that must be passed in as a
string macro.  I'd like to have the program do something like 
    cc -c -o program.o -DFIXLVL=\"testFixLevel\" program.c
such that the quote characters are placed in the C program.  It reports that it
passes on the quote characters, but it really doesn't.  Included below are test
files needed to run this scenario.  Please run ant -debug to verify and observe
the -DFIXLVL on both Ant's output and the output from listargs.  

Thanks,
Ben
---------- begin build.xml ----------------
<?xml version="1.0"?>
<project name="escapeQuoteCharacter" default="run_test_case">

    <!-- 
    Build listargs program to list arguments as truly passed in to called    
program.
    Assumes MSVC, but should be easy to change to something else as needed.
    -->
    <target name="build_listargs">
        <apply executable="cl" dest="." parallel="false">
            <targetfile/>
            <srcfile/>
            <fileset dir=".">
                <include name="listargs.cpp" />
            </fileset>
            <mapper type="glob" from="*.cpp" to="*.exe"/>
        </apply>
    </target>

    <!-- 
    Call listargs program to verify quotes still in -DFIXLVL argument.  The
    -debug option in ant claims they are, listargs says the quotes are missing.

    In otherwords:
    Expected call (and what's reported by the -debug option in ant):  
    listargs -c -o cprogram.obj -'DFIXLVL="test"' cprogram.c 

    Actual call:
    listargs -c -o cprogram.obj -'DFIXLVL=test' cprogram.c 
    -->
    <target name="run_test_case" depends="build_listargs">
        <apply executable="listargs" dest="." parallel="false">
            <arg value="-c"/>
            <arg value="-o"/>
            <targetfile/>
            <arg value="'-DFIXLVL=&quot;test&quot;'"/>
            <srcfile/>
            <fileset dir=".">
                <include name="cprogram.c" />
            </fileset>
            <mapper type="glob" from="*.c" to="*.obj"/>
        </apply>
    </target>
</project>
---------- end build.xml ----------------

---------- begin cprogram.c -------------
static const char fixlevel[] = " " __FILE__ " at " FIXLVL " on " __DATE__ " at "
__TIME__ " ";

int main(int argc, char* argv[])
{
    printf("fixlevel=%s\n",fixlevel);
    return 0;
}
---------- end cprogram.c ---------------

---------- begin listargs.cpp -----------
#include <stdio.h>

int main(int argc, char* argv[])
{
    int i=0;
    for(;i<argc-1;i++)
    {
        printf("%s ",argv[i]);
    }
    printf("%s\n",argv[i]);
    return 0;
}
---------- end listargs.cpp -------------

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message