Hello,
I've ran some tests and I confirm that selectors are not executed on ZipFilesets (at least in the copy task). Here is what happens: * In Copy.java:490 ( https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L490 ), a DirectoryScanner is created when using a standard FileSet. This DirectoryScanner will then execute selectors at line 1505 ( https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/DirectoryScanner.java#L1505 ) * However, a different behavior happens with ZipFileset (in Copy.java line 515 https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L515 ), where the resource is directly added to the list : https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L557 Is that specific to the copy task ? Or do all other tasks behave identically ? And don't you think that selectors should be executed on non-filesystem filesets ? Gilles On Mon, Mar 8, 2021 at 1:14 PM Gilles Querret < g.quer...@riverside-software.fr> wrote: > Hello, > > > I think I've found an issue with selectors which are not executed on > Zipfileset. Here is a very small test case to reproduce the issue: > > <project> > <mkdir dir="target/d2" /> > <mkdir dir="target/d3" /> > > <mkdir dir="src" /> > <echo file="src/test1.txt" message="abc" /> > <echo file="src/test2.txt" message="def" /> > <echo file="src/test3.txt" message="hij" /> > <zip destFile="target/f1.zip"> > <fileset dir="src" /> > </zip> > > <echo message="Standard fileset" /> > <copy toDir="target/d2"> > <fileset dir="src"> > <contains text="def" /> > </fileset> > </copy> > > <echo message="ZIP fileset" /> > <copy toDir="target/d3"> > <zipfileset src="target/f1.zip"> > <contains text="def" /> > </zipfileset> > </copy> > </project> > When executed, the first copy task only copies one file (test2.txt which > contains def), but the second copy task copies all three files. My original > problem was coming from the <different> selector, also not executed on > zipfileset, but it was easier to reproduce with <contains>. > Is that a known issue ? Or just the expected behavior ? > > Gilles > > > -- > Gilles QUERRET > > Riverside Software > 91 chemin des églantiers • 69440 Taluyers • France > Mob : +33 662.525.532 > -- Gilles QUERRET Riverside Software 91 chemin des églantiers • 69440 Taluyers • France Mob : +33 662.525.532