Ticket #137 (closed defect: fixed)
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: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.
