You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2014/03/04 11:05:43 UTC
svn commit: r1573999 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/DirectoryScanner.java
Author: bodewig
Date: Tue Mar 4 10:05:43 2014
New Revision: 1573999
URL: http://svn.apache.org/r1573999
Log:
don't assume File#isDirectory == !File#isFile - i.e. explicitly test
and drop objects that are neither files nor directories. PR 56149
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1573999&r1=1573998&r2=1573999&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Mar 4 10:05:43 2014
@@ -20,6 +20,12 @@ Changes that could break older environme
only on platforms with multiple file syste roots.
Bugzilla Report 53949
+ * DirectoryScanner and thus fileset/dirset will now silently drop all
+ filesystem objects that are neither files nor directories according
+ to java.io.File. This prevents Ant from reading named pipes which
+ might lead to blocking or other undefined behavior.
+ Bugzilla Report 56149
+
Fixed bugs:
-----------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java?rev=1573999&r1=1573998&r2=1573999&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java Tue Mar 4 10:05:43 2014
@@ -1022,7 +1022,7 @@ public class DirectoryScanner
} else {
scandir(myfile, currentPath, true);
}
- } else {
+ } else if (myfile.isFile()) {
String originalpattern = (String) entry.getValue();
boolean included = isCaseSensitive()
? originalpattern.equals(currentelement)
@@ -1222,8 +1222,11 @@ public class DirectoryScanner
if (SYMLINK_UTILS.isSymbolicLink(dir, newfiles[i])) {
String name = vpath + newfiles[i];
File file = new File(dir, newfiles[i]);
- (file.isDirectory()
- ? dirsExcluded : filesExcluded).addElement(name);
+ if (file.isDirectory()) {
+ dirsExcluded.addElement(name);
+ } else if (file.isFile()) {
+ filesExcluded.addElement(name);
+ }
accountForNotFollowedSymlink(name, file);
} else {
noLinks.add(newfiles[i]);
@@ -1253,7 +1256,7 @@ public class DirectoryScanner
everythingIncluded = false;
filesNotIncluded.addElement(name);
}
- } else { // dir
+ } else if (file.isDirectory()) { // dir
if (followSymlinks
&& causesIllegalSymlinkLoop(newfiles[i], dir,