Browse Source

honor followsymlinks on a fileset's dir as well. PR 45741.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@693846 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
4464369821
3 changed files with 17 additions and 2 deletions
  1. +5
    -0
      WHATSNEW
  2. +10
    -0
      src/main/org/apache/tools/ant/DirectoryScanner.java
  3. +2
    -2
      src/tests/antunit/core/dirscanner-symlinks-test.xml

+ 5
- 0
WHATSNEW View File

@@ -101,6 +101,11 @@ Changes that could break older environments:
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:
-----------



+ 10
- 0
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -786,6 +786,7 @@ public class DirectoryScanner
}
scanning = true;
}
File savedBase = basedir;
try {
synchronized (this) {
illegal = null;
@@ -797,6 +798,12 @@ public class DirectoryScanner
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 @@ public class DirectoryScanner
includes = nullIncludes ? null : includes;
excludes = nullExcludes ? null : excludes;
}
} catch (IOException ex) {
throw new BuildException(ex);
} finally {
basedir = savedBase;
synchronized (scanLock) {
scanning = false;
scanLock.notifyAll();


+ 2
- 2
src/tests/antunit/core/dirscanner-symlinks-test.xml View File

@@ -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">


Loading…
Cancel
Save