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 2008/09/10 16:01:30 UTC

svn commit: r693846 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/DirectoryScanner.java src/tests/antunit/core/dirscanner-symlinks-test.xml

Author: bodewig
Date: Wed Sep 10 07:01:29 2008
New Revision: 693846

URL: http://svn.apache.org/viewvc?rev=693846&view=rev
Log:
honor followsymlinks on a fileset's dir as well.  PR 45741.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
    ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=693846&r1=693845&r2=693846&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Sep 10 07:01:29 2008
@@ -101,6 +101,11 @@
    The task will now try to delete them in both cases.
    Bugzilla Report 41285.
 
+ * if the dir attribute of a <fileset> point to a symbolic link and
+   followsymlinks is set to false, the fileset will no longer be
+   scanned and always seem empty.
+   Bugzilla Report 45741.
+
 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=693846&r1=693845&r2=693846&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 Wed Sep 10 07:01:29 2008
@@ -786,6 +786,7 @@
             }
             scanning = true;
         }
+        File savedBase = basedir;
         try {
             synchronized (this) {
                 illegal = null;
@@ -797,6 +798,12 @@
                 boolean nullExcludes = (excludes == null);
                 excludes = nullExcludes ? new String[0] : excludes;
 
+                if (basedir != null && !followSymlinks
+                    && FILE_UTILS.isSymbolicLink(basedir.getParentFile(),
+                                                 basedir.getName())) {
+                    basedir = null;
+                }
+
                 if (basedir == null) {
                     // if no basedir and no includes, nothing to do:
                     if (nullIncludes) {
@@ -839,7 +846,10 @@
                 includes = nullIncludes ? null : includes;
                 excludes = nullExcludes ? null : excludes;
             }
+        } catch (IOException ex) {
+            throw new BuildException(ex);
         } finally {
+            basedir = savedBase;
             synchronized (scanLock) {
                 scanning = false;
                 scanLock.notifyAll();

Modified: ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml?rev=693846&r1=693845&r2=693846&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/core/dirscanner-symlinks-test.xml Wed Sep 10 07:01:29 2008
@@ -66,7 +66,7 @@
     <au:assertFileExists file="${output}/file.txt"/>
   </target>
 
-  <target name="FAILStestBasedirIsSymlinkNoFollow"
+  <target name="testBasedirIsSymlinkNoFollow"
           depends="checkOs, setUp, -basedir-as-symlink"
           if="unix">
     <copy todir="${output}">
@@ -137,7 +137,7 @@
       <fileset dir="${base}" followsymlinks="false"/>
     </copy>
     <symlink action="delete" link="${base}"/>
-    <assertDirIsEmpty/>
+    <au:assertFileDoesntExist file="${output}"/>
   </target>
 
   <target name="-sibling" if="unix">