Bug 62544 - includesfile ignores entries starting with ./
Summary: includesfile ignores entries starting with ./
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.10.5
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-16 14:24 UTC by Emmanuel Bourg
Modified: 2018-08-16 12:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Bourg 2018-07-16 14:24:53 UTC
It looks like a fileset using the includesfile attribute skips the entries with a relative path starting with "./".

Here is an example illustrating the issue, a simple class importing an Ant package is compiled. The elements of the classpath are defined in a 'dependencies' file. The first compilation uses a relative path starting directly with the name of the jar, and the second compilation uses a relative path prefixed by "./". The first compilation works but the second one fails:


<?xml version="1.0" encoding="UTF-8"?>
<project default="compile">

  <target name="compile">
    <copy file="${ant.home}/lib/ant.jar" todir="."/>
    <echo file="Test.java">import org.apache.tools.ant.types.*; public class Test {}</echo>

    <echo file="dependencies">ant.jar</echo>
    <javac srcdir="." destdir="." includeantruntime="false">
      <classpath>
        <fileset dir="." includesfile="dependencies"/>
      </classpath>
    </javac>

    <delete file="Test.class"/>

    <echo file="dependencies">./ant.jar</echo>
    <javac srcdir="." destdir="." includeantruntime="false">
      <classpath>
        <fileset dir="." includesfile="dependencies"/>
      </classpath>
    </javac>
  </target>

</project>
Comment 1 Stefan Bodewig 2018-07-28 15:35:40 UTC
For better or worse, this is how patterns work in Ant.

  <target name="compile2">
    <copy file="${ant.home}/lib/ant.jar" todir="."/>
    <echo file="Test.java">import org.apache.tools.ant.types.*; public class Test {}</echo>

    <javac srcdir="." destdir="." includeantruntime="false">
      <classpath>
        <fileset dir="." includes="ant.jar"/>
      </classpath>
    </javac>

    <delete file="Test.class"/>

    <javac srcdir="." destdir="." includeantruntime="false">
      <classpath>
        <fileset dir="." includes="./ant.jar"/>
      </classpath>
    </javac>
  </target>

will tell you ./ant.jar doesn't match either.
Comment 2 Emmanuel Bourg 2018-08-06 13:52:42 UTC
(In reply to Stefan Bodewig from comment #1)
> For better or worse, this is how patterns work in Ant.
Is it set in stone, or does handling "./" as "" sound like a reasonable suggestion?
Comment 3 Jaikiran Pai 2018-08-16 12:42:22 UTC
>> Is it set in stone, or does handling "./" as "" sound like a reasonable suggestion?

I think that could impact backward compatibility.

Alternatively, would making a note in the documentation about how it currently behaves, help?