Ticket #137 (new defect)

Opened 9 months ago

Last modified 9 months ago

Excluded files may be included in Zip/Tar tasks

Reported by: hans Assigned to: hans
Priority: major Milestone: 3.0
Component: phing-tasks-ext Version: devel
Keywords: Cc:

Description (Last modified by hans)

Currently, if a top-level directory is included in the Zip/Tar task, the full contents of this directory will be added to the Zip/Tar.

Assuming the following basic filesystem structure:

  • testdir/
    • CVS/
    • donkey.txt
  • include.txt
  • include2.txt

Here is an example buildfile that produces unexpected results:

<project name="foo" default="build">

<target name="build">

        <delete file="test.tgz"/>
        <delete file="test.zip"/>

        <fileset dir="." id="archive.files">
                <include name="testdir"/>
                <include name="include*.txt"/>
                <exclude name="testdir/CVS"/>
        </fileset>

        <tar destfile="test.tgz" compression="gzip">
              <fileset refid="archive.files"/>
        </tar>

        <zip destfile="test.zip">
              <fileset refid="archive.files"/>
        </zip>

</target>

</project>

The unexpected result is that testdir/CVS will be included, despite being explicitly excluded. This is due to the way that file/dir additions are processed by the underlying zip/tar libraries.

One workaround currently would be to define the fileset as such:

        <fileset dir="." id="archive.files">
                <include name="testdir/**"/> <!-- NOTE DIFFERENCE -->
                <include name="include*.txt"/>
                <exclude name="testdir/CVS"/>
        </fileset>

Attachments

Change History

08/21/07 00:11:24 changed by hans

  • description changed.

Add/Change #137 (Excluded files may be included in Zip/Tar tasks)