Browse Source

Revert "bz-62849 Check for filesystem loops due to symbolic links, in DirectoryScanner and Delete task" since it causes a regression that's exposed by the dirscanner-symlinks-test.xml antunit testcase

This reverts commit 05bfffa247 and 506c3ab47a.
master
Jaikiran Pai 6 years ago
parent
commit
8cc8feebb0
7 changed files with 1 additions and 55 deletions
  1. +0
    -1
      CONTRIBUTORS
  2. +0
    -5
      WHATSNEW
  3. +0
    -4
      contributors.xml
  4. +0
    -5
      src/etc/testcases/core/directoryscanner.xml
  5. +0
    -12
      src/main/org/apache/tools/ant/DirectoryScanner.java
  6. +1
    -14
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  7. +0
    -14
      src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java

+ 0
- 1
CONTRIBUTORS View File

@@ -263,7 +263,6 @@ Matthew Kuperus Heun
Matthew Watson
Matthew Yanos
Matthias Bhend
Michael Barker
Michael Bayne
Michael Clarke
Michael Davey


+ 0
- 5
WHATSNEW View File

@@ -16,11 +16,6 @@ Fixed bugs:
an incorrect compression level for a zip entry. This is now fixed.
Bugzilla Report 62686

* A filesystem "loop" caused due to symbolic links could trigger an
out of memory error in the org.apache.tools.ant.DirectoryScanner
This has now been fixed.
Bugzilla Report 62849

Other changes:
--------------
* generatekey task now supports SubjectAlternativeName during key


+ 0
- 4
contributors.xml View File

@@ -1073,10 +1073,6 @@
<first>Matthew</first>
<last>Yanos</last>
</name>
<name>
<first>Michael</first>
<last>Barker</last>
</name>
<name>
<first>Michael</first>
<last>Bayne</last>


+ 0
- 5
src/etc/testcases/core/directoryscanner.xml View File

@@ -38,9 +38,4 @@
<touch file="${output}/alpha/beta/gamma/gamma.xml"/>
</target>

<target name="symlink-nested-setup" depends="setUp">
<symlink link="${output}/alpha/beta/gamma/beta-link" resource="${output}/alpha/beta"/>
<touch file="${output}/alpha/beta/gamma/gamma.xml"/>
</target>

</project>

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

@@ -1258,18 +1258,6 @@ public class DirectoryScanner
final String name = vpath + newFile;
final TokenizedPath newPath = new TokenizedPath(path, newFile);
final File file = new File(dir, newFile);

try {
// check if it's a filesystem "loop" due to symbolic links
if (FileUtils.getFileUtils().isLeadingPath(file.getAbsoluteFile(),
dir.getAbsoluteFile(), true)) {
continue;
}
} catch (IOException e) {
System.err.println("Failed to determine if " + file + " causes a " +
"filesystem loop due to symbolic link; continuing");
}

final String[] children = file.list();
if (children == null || (children.length == 0 && file.isFile())) {
if (isIncluded(newPath)) {


+ 1
- 14
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -19,7 +19,6 @@
package org.apache.tools.ant.taskdefs;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
@@ -772,19 +771,7 @@ public class Delete extends MatchingTask {
}
for (String s : list) {
File f = new File(d, s);

boolean isFsLoop = false;

try {
isFsLoop = SYMLINK_UTILS.isSymbolicLink(f) &&
FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(),
d.getAbsoluteFile(), true);
} catch (IOException e) {
log("Failed to check if " + f + " causes a filesystem loop due to " +
"symbolic link; continuing");
}

if (f.isDirectory() && !isFsLoop) {
if (f.isDirectory()) {
removeDir(f);
} else {
log("Deleting " + f.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity);


+ 0
- 14
src/tests/junit/org/apache/tools/ant/DirectoryScannerTest.java View File

@@ -132,20 +132,6 @@ public class DirectoryScannerTest {
new String[] {"alpha/beta/gamma"});
}

@Test
public void testAllowRecursiveSymlinks() {

assumeTrue("Current system does not support Symlinks", supportsSymlinks);

buildRule.getProject().executeTarget("symlink-nested-setup");
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(new File(buildRule.getProject().getProperty("output")));
ds.setIncludes(new String[] {"alpha/beta/gamma/"});
ds.scan();
compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
new String[] {"alpha/beta/gamma"});
}

@Test
public void testProhibitSymlinks() {
assumeTrue("Current system does not support Symlinks", supportsSymlinks);


Loading…
Cancel
Save