Qpid
  1. Qpid
  2. QPID-2526

Ant build fails if the path contains a space character

    Details

      Description

      The gentools target of the common module fails when the path contains a space character.

      For example if the project sources are copied into /home/ebourg/Apache Qpid, the following error occurs:

      gentools:
           [java] XML files: [Qpid/java/build/scratch/common/src/org/apache/qpid/framing, Qpid/java/common/templates, /home/ebourg/Apache, Qpid/specs/amqp.0-8.xml, /home/ebourg/Apache, Qpid/specs/amqp.0-9.xml, /home/ebourg/Apache, Qpid/specs/amqp0-9-1.stripped.xml]
           [java] ERROR: AMQP XML file "Qpid/java/build/scratch/common/src/org/apache/qpid/framing" not found.
           [java] ERROR: AMQP XML file "Qpid/java/common/templates" not found.
           [java] [Fatal Error] :1:1: Premature end of file.
           [java] org.xml.sax.SAXParseException: Premature end of file.
           [java]     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
           [java]     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
           [java]     at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
           [java]     at org.apache.qpid.gentools.Main.analyzeXML(Main.java:193)
           [java]     at org.apache.qpid.gentools.Main.run(Main.java:118)
           [java]     at org.apache.qpid.gentools.Main.main(Main.java:239)
           [java]   "/home/ebourg/Apache":
      
      1. QPID-2526-HandleSpacesInLogMessagesPath.patch
        0.7 kB
        Martin Ritchie
      2. build-slowconsumer.patch
        1 kB
        Emmanuel Bourg
      3. build-broker.patch
        1.0 kB
        Emmanuel Bourg
      4. build-common.patch
        2 kB
        Emmanuel Bourg

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        40d 7h 1 Robbie Gemmell 31/May/10 20:15
        In Progress In Progress Resolved Resolved
        44s 1 Robbie Gemmell 31/May/10 20:16
        Reopened Reopened In Progress In Progress
        36m 59s 1 Robbie Gemmell 08/Jun/10 23:25
        In Progress In Progress Reviewable Reviewable
        5s 1 Robbie Gemmell 08/Jun/10 23:25
        Reviewable Reviewable Resolved Resolved
        23s 1 Robbie Gemmell 08/Jun/10 23:26
        Resolved Resolved Reopened Reopened
        22d 12h 26m 2 Emmanuel Bourg 23/Jun/10 09:19
        Reopened Reopened Resolved Resolved
        28d 23h 20m 1 Robbie Gemmell 22/Jul/10 08:40
        Resolved Resolved Closed Closed
        1665d 11h 26m 1 Rob Godfrey 11/Feb/15 20:07
        Rob Godfrey made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Rob Godfrey made changes -
        Component/s Ant Build System [ 12311471 ]
        Rob Godfrey made changes -
        Labels ant_build_system
        Robbie Gemmell made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Robbie Gemmell added a comment -

        Martin commited the above noted fix previously, this should be resolved.

        Show
        Robbie Gemmell added a comment - Martin commited the above noted fix previously, this should be resolved.
        Hide
        Emmanuel Bourg added a comment -

        This solution is fine, thank you for the fix Martin.

        Show
        Emmanuel Bourg added a comment - This solution is fine, thank you for the fix Martin.
        Martin Ritchie made changes -
        Hide
        Martin Ritchie added a comment -

        Apologies Emmanuel, for the break in the build wrt to spaces in the paths.

        I've attached a patch that should correctly quote the files provided to the Generator. I tested this on my linux box by using a path that had a space in the file name.

        I prefer this approach because it seems strange to provide an OS specific listing of files to the log generator. It should simply be a list of files.

        Show
        Martin Ritchie added a comment - Apologies Emmanuel, for the break in the build wrt to spaces in the paths. I've attached a patch that should correctly quote the files provided to the Generator. I tested this on my linux box by using a path that had a space in the file name. I prefer this approach because it seems strange to provide an OS specific listing of files to the log generator. It should simply be a list of files.
        Hide
        Emmanuel Bourg added a comment -

        Here is how to fix this:

        Index: broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java
        ===================================================================
        --- broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java (révision 957144)
        +++ broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java (copie de travail)
        @@ -131,9 +131,13 @@
                 for (int i = 0; i < args.length; i++)
                 {
                     String arg = args[i];
        -            if (args[i].endsWith("_logmessages.properties"))
        +            if (args[i].contains("_logmessages.properties"))
                     {
        -                _logMessages.add(args[i]);
        +                String[] bundles = args[i].split(File.pathSeparator);
        +                for (String bundle : bundles)
        +                {
        +                    _logMessages.add(bundle);
        +                }
                     }
                     else if (arg.charAt(0) == '-')
                     {
        
        

        and in module.xml:

        @@ -710,14 +759,12 @@
                 </fileset>
               </path>
         
        -      <pathconvert property="logmessages"
        -                   refid="logmessages.path"
        -                   pathsep=" "/>
        +      <pathconvert property="logmessages" refid="logmessages.path"/>
         
               <echo message="logmessages is ${logmessages}"/>
         
               <java classname="org.apache.qpid.server.logging.GenerateLogMessages" fork="true" dir="${gentools.home}/src" failonerror="true">
        -        <arg line="${logmessages}"/>
        +        <arg value="${logmessages}"/>
                   <arg value="-j"/>
                   <arg value="-o"/>
                   <arg value="${generated.dir}"/>
        
        
        Show
        Emmanuel Bourg added a comment - Here is how to fix this: Index: broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java =================================================================== --- broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java (révision 957144) +++ broker/src/velocity/java/org/apache/qpid/server/logging/GenerateLogMessages.java (copie de travail) @@ -131,9 +131,13 @@ for ( int i = 0; i < args.length; i++) { String arg = args[i]; - if (args[i].endsWith( "_logmessages.properties" )) + if (args[i].contains( "_logmessages.properties" )) { - _logMessages.add(args[i]); + String [] bundles = args[i].split(File.pathSeparator); + for ( String bundle : bundles) + { + _logMessages.add(bundle); + } } else if (arg.charAt(0) == '-') { and in module.xml: @@ -710,14 +759,12 @@ </fileset> </path> - <pathconvert property= "logmessages" - refid= "logmessages.path" - pathsep= " " /> + <pathconvert property= "logmessages" refid= "logmessages.path" /> <echo message= "logmessages is ${logmessages}" /> <java classname= "org.apache.qpid.server.logging.GenerateLogMessages" fork= " true " dir= "${gentools.home}/src" failonerror= " true " > - <arg line= "${logmessages}" /> + <arg value= "${logmessages}" /> <arg value= "-j" /> <arg value= "-o" /> <arg value= "${generated.dir}" />
        Emmanuel Bourg made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Emmanuel Bourg added a comment -

        Reopening sorry, the gen_logging target moved to module.xml and breaks again when the path contains a space character.

        Show
        Emmanuel Bourg added a comment - Reopening sorry, the gen_logging target moved to module.xml and breaks again when the path contains a space character.
        Hide
        Emmanuel Bourg added a comment -

        That was fast, thank you!

        Show
        Emmanuel Bourg added a comment - That was fast, thank you!
        Robbie Gemmell made changes -
        Status Ready To Review [ 10006 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Robbie Gemmell added a comment -

        Additional patch applied.

        Show
        Robbie Gemmell added a comment - Additional patch applied.
        Robbie Gemmell made changes -
        Status In Progress [ 3 ] Ready To Review [ 10006 ]
        Robbie Gemmell made changes -
        Status Reopened [ 4 ] In Progress [ 3 ]
        Emmanuel Bourg made changes -
        Attachment build-slowconsumer.patch [ 12446635 ]
        Emmanuel Bourg made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Emmanuel Bourg added a comment -

        Reopening because the same issue has been reintroduced in the build file of the slow consumer plugin.

        Show
        Emmanuel Bourg added a comment - Reopening because the same issue has been reintroduced in the build file of the slow consumer plugin.
        Robbie Gemmell made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Robbie Gemmell added a comment -

        Patches applied

        Show
        Robbie Gemmell added a comment - Patches applied
        Robbie Gemmell made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Robbie Gemmell made changes -
        Assignee Robbie Gemmell [ gemmellr ]
        Hide
        Emmanuel Bourg added a comment -

        The same issue exists with the pom target, the arguments for jython are not properly quoted.

        Show
        Emmanuel Bourg added a comment - The same issue exists with the pom target, the arguments for jython are not properly quoted.
        Emmanuel Bourg made changes -
        Summary 'ant build' fails if the path contains a space character Ant build fails if the path contains a space character
        Hide
        Emmanuel Bourg added a comment -

        I've found another error in the build related to the space in the path, this time in the creation of the OSGi bundles. For some reason the bnd task doesn't create the jar and no error is produced immediately. It breaks later with this message:

        release-bin-qpid-management-common-plugin:
        
        BUILD FAILED
        /var/lib/hudson/jobs/Apache Qpid/workspace/qpid/java/build.xml:110: The following error occurred while executing this line:
        /var/lib/hudson/jobs/Apache Qpid/workspace/qpid/java/build.xml:54: The following error occurred while executing this line:
        /var/lib/hudson/jobs/Apache Qpid/workspace/qpid/java/management/eclipse-plugin/build.xml:58: The following error occurred while executing this line:
        /var/lib/hudson/jobs/Apache Qpid/workspace/qpid/java/management/eclipse-plugin/build-release.xml:79: Please run ant bundle for the management-common module
        

        Upgrading to the latest version of bnd (0.0.384) solved the issue. It can be downloaded here:

        http://www.aqute.biz/repo/biz/aQute/bnd/0.0.384/bnd-0.0.384.jar

        Show
        Emmanuel Bourg added a comment - I've found another error in the build related to the space in the path, this time in the creation of the OSGi bundles. For some reason the bnd task doesn't create the jar and no error is produced immediately. It breaks later with this message: release-bin-qpid-management-common-plugin: BUILD FAILED / var /lib/hudson/jobs/Apache Qpid/workspace/qpid/java/build.xml:110: The following error occurred while executing this line: / var /lib/hudson/jobs/Apache Qpid/workspace/qpid/java/build.xml:54: The following error occurred while executing this line: / var /lib/hudson/jobs/Apache Qpid/workspace/qpid/java/management/eclipse-plugin/build.xml:58: The following error occurred while executing this line: / var /lib/hudson/jobs/Apache Qpid/workspace/qpid/java/management/eclipse-plugin/build-release.xml:79: Please run ant bundle for the management-common module Upgrading to the latest version of bnd (0.0.384) solved the issue. It can be downloaded here: http://www.aqute.biz/repo/biz/aQute/bnd/0.0.384/bnd-0.0.384.jar
        Emmanuel Bourg made changes -
        Summary 'ant gentools' fails if the path contains a space character 'ant build' fails if the path contains a space character
        Component/s Java Broker [ 12311388 ]
        Emmanuel Bourg made changes -
        Attachment build-broker.patch [ 12442446 ]
        Hide
        Emmanuel Bourg added a comment -

        There is also a similar issue with the call to GenerateLogMessages in the broker build. Patch attached.

        Show
        Emmanuel Bourg added a comment - There is also a similar issue with the call to GenerateLogMessages in the broker build. Patch attached.
        Emmanuel Bourg made changes -
        Priority Minor [ 4 ] Trivial [ 5 ]
        Emmanuel Bourg made changes -
        Field Original Value New Value
        Attachment build-common.patch [ 12442443 ]
        Hide
        Emmanuel Bourg added a comment -

        I attached a patch that quotes the parameters of org.apache.qpid.gentools.Main. It works on Windows and Linux.

        The same change could probably be applied to java/common/protocol-version.xml but I'm not sure if this file is still used.

        Show
        Emmanuel Bourg added a comment - I attached a patch that quotes the parameters of org.apache.qpid.gentools.Main. It works on Windows and Linux. The same change could probably be applied to java/common/protocol-version.xml but I'm not sure if this file is still used.
        Emmanuel Bourg created issue -

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            Emmanuel Bourg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development