Modify

Ticket #137 (closed defect: fixed)

Opened 3 years ago

Last modified 10 months ago

Excluded files may be included in Zip/Tar tasks

Reported by: hans Owned by: mrook
Priority: major Milestone: 2.4.0RC3
Component: phing-tasks-ext Version: devel
Keywords: Cc:

Description (last modified by hans) (diff)

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

comment:1 Changed 3 years ago by hans

  • Description modified (diff)

comment:2 Changed 10 months ago by mrook

  • Owner changed from hans to mrook
  • Status changed from new to assigned
  • Milestone changed from 3.0 to 2.4.0RC3

comment:3 Changed 10 months ago by mrook

This still occurs, in a somewhat different setting, due to a bug created in the fix for #342.

See also this comment by Christian Weiske:

This code:
    <zip destfile="SemanticScuttle-${version}.zip">
      <fileset dir=".">
        <include name="**"/>
        <exclude name="**/.gitignore"/>
        <exclude name=".svn/"/>
        <exclude name=".git/"/>
        <exclude name="cache/"/>
        <exclude name="build.xml"/>
        <exclude name="data/config.php"/>
      </fileset>
    </zip>
excludes build.xml, but not .git, .svn nor cache. If I remove the
trailing / to the directories, nothing changes.

comment:4 Changed 10 months ago by mrook

(In [617]) Refs #137 #342 - fix inadvertent include of excluded directories

comment:5 Changed 10 months ago by mrook

  • Status changed from assigned to closed
  • Resolution set to fixed

Should be fixed in r617!

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.